mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
gst: stop the thread loop before destroying objects
When we destroy the proxy we should either take the thread lock or stop the thread loop because the destroy might trigger a reply to remove the object from another thread. This can cause the refcounting to become invalid and cause double free. Fixes #286
This commit is contained in:
parent
38f8c9c6c8
commit
f6bc9113ce
1 changed files with 4 additions and 0 deletions
|
|
@ -571,6 +571,7 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
||||||
GST_DEBUG_OBJECT (self, "disconnect");
|
GST_DEBUG_OBJECT (self, "disconnect");
|
||||||
pw_proxy_destroy ((struct pw_proxy*)data->registry);
|
pw_proxy_destroy ((struct pw_proxy*)data->registry);
|
||||||
pw_core_disconnect (self->core);
|
pw_core_disconnect (self->core);
|
||||||
|
self->core = NULL;
|
||||||
pw_context_destroy (c);
|
pw_context_destroy (c);
|
||||||
pw_loop_destroy (l);
|
pw_loop_destroy (l);
|
||||||
|
|
||||||
|
|
@ -660,6 +661,9 @@ gst_pipewire_device_provider_stop (GstDeviceProvider * provider)
|
||||||
GstPipeWireDeviceProvider *self = GST_PIPEWIRE_DEVICE_PROVIDER (provider);
|
GstPipeWireDeviceProvider *self = GST_PIPEWIRE_DEVICE_PROVIDER (provider);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "stopping provider");
|
GST_DEBUG_OBJECT (self, "stopping provider");
|
||||||
|
if (self->loop)
|
||||||
|
pw_thread_loop_stop (self->loop);
|
||||||
|
|
||||||
if (self->registry) {
|
if (self->registry) {
|
||||||
pw_proxy_destroy ((struct pw_proxy*)self->registry);
|
pw_proxy_destroy ((struct pw_proxy*)self->registry);
|
||||||
self->registry = NULL;
|
self->registry = NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue