core: ensure we don't remove and disconnect twice

Check for multiple recursive disconnect calls by checking the flags
before calling the pw_proxy methods. This ensure that calling disconnect
from one of the proxy removed callbacks does not trigger another
disconnect later on.
This commit is contained in:
Wim Taymans 2023-06-19 12:31:46 +02:00
parent 6fc9914431
commit d321e9b93e

View file

@ -479,7 +479,9 @@ SPA_EXPORT
int pw_core_disconnect(struct pw_core *core)
{
pw_log_debug("%p: disconnect", core);
pw_proxy_remove(&core->proxy);
pw_proxy_destroy(&core->proxy);
if (!core->removed)
pw_proxy_remove(&core->proxy);
if (!core->destroyed)
pw_proxy_destroy(&core->proxy);
return 0;
}