mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
proxy: improve cleanup
Remove the core_proxy from objects so that it doesn't try to use it when it's being destroyed. We need to recheck the core_proxy because it might have been removed in the destroy signal.
This commit is contained in:
parent
7b0b5b77c3
commit
05565b21b1
2 changed files with 11 additions and 7 deletions
|
|
@ -167,9 +167,14 @@ void *pw_core_proxy_get_user_data(struct pw_core_proxy *core_proxy)
|
|||
static int destroy_proxy(void *object, void *data)
|
||||
{
|
||||
struct pw_core_proxy *core_proxy = data;
|
||||
struct pw_proxy *p = object;
|
||||
|
||||
if (object && object != core_proxy)
|
||||
pw_proxy_destroy(object);
|
||||
if (object == NULL)
|
||||
return 0;
|
||||
|
||||
p->core_proxy = NULL;
|
||||
if (object != core_proxy)
|
||||
pw_proxy_remove(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,8 +200,6 @@ void pw_proxy_add_object_listener(struct pw_proxy *proxy,
|
|||
SPA_EXPORT
|
||||
void pw_proxy_destroy(struct pw_proxy *proxy)
|
||||
{
|
||||
struct pw_core_proxy *core_proxy = proxy->core_proxy;
|
||||
|
||||
if (!proxy->zombie) {
|
||||
pw_log_debug(NAME" %p: destroy %u", proxy, proxy->id);
|
||||
pw_proxy_emit_destroy(proxy);
|
||||
|
|
@ -209,15 +207,16 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
|
|||
if (!proxy->removed) {
|
||||
/* if the server did not remove this proxy, remove ourselves
|
||||
* from the proxy objects and schedule a destroy. */
|
||||
if (core_proxy) {
|
||||
if (proxy->core_proxy) {
|
||||
proxy->zombie = true;
|
||||
pw_core_proxy_destroy(core_proxy, proxy);
|
||||
pw_core_proxy_destroy(proxy->core_proxy, proxy);
|
||||
} else {
|
||||
proxy->removed = true;
|
||||
}
|
||||
}
|
||||
if (proxy->removed) {
|
||||
pw_map_remove(&core_proxy->objects, proxy->id);
|
||||
if (proxy->core_proxy)
|
||||
pw_map_remove(&proxy->core_proxy->objects, proxy->id);
|
||||
|
||||
pw_proxy_unref(proxy);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue