jack: take the right locks when modifying globals.

This commit is contained in:
Wim Taymans 2024-09-26 16:42:20 +02:00
parent 4d7f9c3208
commit 59525b43e6

View file

@ -4406,6 +4406,7 @@ int jack_client_close (jack_client_t *client)
continue;
free_port(c, item->data, false);
}
pthread_mutex_lock(&globals.lock);
spa_list_consume(o, &c->context.objects, link) {
bool to_free = o->to_free;
spa_list_remove(&o->link);
@ -4413,6 +4414,7 @@ int jack_client_close (jack_client_t *client)
o->to_free = to_free;
spa_list_append(&globals.free_objects, &o->link);
}
pthread_mutex_unlock(&globals.lock);
spa_list_for_each_safe(m, tm, &c->free_mix, link) {
if (!m->to_free)
@ -7560,6 +7562,7 @@ static void unreg(void) __attribute__ ((destructor));
static void unreg(void)
{
struct object *o, *to;
pthread_mutex_lock(&globals.lock);
spa_list_for_each_safe(o, to, &globals.free_objects, link) {
if (!o->to_free)
spa_list_remove(&o->link);
@ -7568,5 +7571,6 @@ static void unreg(void)
spa_list_remove(&o->link);
free(o);
}
pthread_mutex_unlock(&globals.lock);
pw_deinit();
}