Commit 92107e83 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

object-manager: keep a reference to self while doing a core sync

Otherwise, if the object manager is destroyed while a sync is in progress,
we get an invalid 'self' pointer on the callback later, which is being
called regardless

There is a bit more work that should be done in the core to avoid leaking
this ref in case pipewire disconnects before the sync is completed
parent d5c3f7ee
......@@ -362,7 +362,7 @@ wp_object_manager_is_interested_in_global (WpObjectManager * self,
static void
sync_emit_objects_changed (WpCore *core, GAsyncResult *res, gpointer data)
WpObjectManager *self = data;
g_autoptr (WpObjectManager) self = WP_OBJECT_MANAGER (data);
g_signal_emit (self, signals[SIGNAL_OBJECTS_CHANGED], 0);
self->pending_objchanged = FALSE;
......@@ -377,7 +377,7 @@ schedule_emit_objects_changed (WpObjectManager * self)
g_autoptr (WpCore) core = g_weak_ref_get (&self->core);
if (core) {
wp_core_sync (core, NULL, (GAsyncReadyCallback)sync_emit_objects_changed,
g_object_ref (self));
self->pending_objchanged = TRUE;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment