remove hooks from objects

Remove the hooks we installed on objects in the destroy/free event
or before calling _destroy. This is not really needed but it is
a nice thing to do because it calls the hook removed callbacks.
This commit is contained in:
Wim Taymans 2020-11-06 15:53:32 +01:00
parent 6317bc4deb
commit 1570e62635
19 changed files with 109 additions and 27 deletions

View file

@ -79,10 +79,12 @@ static void context_unlink(pa_context *c)
PA_STREAM_FAILED : PA_STREAM_TERMINATED);
}
if (c->registry) {
spa_hook_remove(&c->core_listener),
pw_proxy_destroy((struct pw_proxy*)c->registry);
c->registry = NULL;
}
if (c->core) {
spa_hook_remove(&c->core_listener);
pw_core_disconnect(c->core);
c->core = NULL;
}
@ -1897,10 +1899,12 @@ void pa_context_disconnect(pa_context *c)
c->disconnect = true;
if (c->registry) {
spa_hook_remove(&c->registry_listener),
pw_proxy_destroy((struct pw_proxy*)c->registry);
c->registry = NULL;
}
if (c->core) {
spa_hook_remove(&c->core_listener),
pw_core_disconnect(c->core);
c->core = NULL;
}