mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-21 08:56:56 -05:00
proxy: don't remove the hooks, but report them leaking
When a client forgets to remove a hook, report them leaked in the debug log. This is not a problem because we don't usually add our own removed hook for proxies. The problem is that we can't forcibly remove them with _clean() from _destroy() because the hooks might be emitting the removed event or the object listener. We could try to remove them in the final unref but it seems some apps free their data before that and then we unref invalid memory.
This commit is contained in:
parent
5fd427b86a
commit
50c5485efc
1 changed files with 8 additions and 3 deletions
|
|
@ -256,9 +256,6 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
|
|||
pw_proxy_emit_destroy(proxy);
|
||||
}
|
||||
|
||||
spa_hook_list_clean(&proxy->listener_list);
|
||||
spa_hook_list_clean(&proxy->object_listener_list);
|
||||
|
||||
pw_proxy_unref(proxy);
|
||||
}
|
||||
|
||||
|
|
@ -291,6 +288,8 @@ void pw_proxy_remove(struct pw_proxy *proxy)
|
|||
SPA_EXPORT
|
||||
void pw_proxy_unref(struct pw_proxy *proxy)
|
||||
{
|
||||
struct spa_hook *h;
|
||||
|
||||
assert(proxy->refcount > 0);
|
||||
if (--proxy->refcount > 0)
|
||||
return;
|
||||
|
|
@ -298,6 +297,12 @@ void pw_proxy_unref(struct pw_proxy *proxy)
|
|||
pw_log_debug("%p: free %u", proxy, proxy->id);
|
||||
/** client must explicitly destroy all proxies */
|
||||
assert(proxy->destroyed);
|
||||
|
||||
spa_list_for_each(h, &proxy->object_listener_list.list, link)
|
||||
pw_log_debug("%p: leaked proxy object listener %p id:%d", proxy, h, proxy->id);
|
||||
spa_list_for_each(h, &proxy->listener_list.list, link)
|
||||
pw_log_debug("%p: leaked proxy listener %p id:%d", proxy, h, proxy->id);
|
||||
|
||||
free(proxy);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue