mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
screen-cast-stream-src: Don't leak GSource
For every stream src, we created and attached a GSource. Upon stream src destruction, we g_source_destroy():ed the GSource. What g_source_destroy() does, hawever, is not really "destroy" it but only detaches it from the main context removing the reference the context had added for it via g_source_attach(). This caused the GSource to leak, although in a detached state, as the reference taken on creation was still held. Fix this by also removing our own reference to it when finalizing. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1106
This commit is contained in:
parent
480e7d44be
commit
26e1e495a0
@ -885,7 +885,7 @@ create_pipewire_source (void)
|
|||||||
pipewire_source->pipewire_loop = pw_loop_new (NULL);
|
pipewire_source->pipewire_loop = pw_loop_new (NULL);
|
||||||
if (!pipewire_source->pipewire_loop)
|
if (!pipewire_source->pipewire_loop)
|
||||||
{
|
{
|
||||||
g_source_destroy ((GSource *) pipewire_source);
|
g_source_unref ((GSource *) pipewire_source);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,6 +980,7 @@ meta_screen_cast_stream_src_finalize (GObject *object)
|
|||||||
g_clear_pointer (&priv->pipewire_core, pw_core_disconnect);
|
g_clear_pointer (&priv->pipewire_core, pw_core_disconnect);
|
||||||
g_clear_pointer (&priv->pipewire_context, pw_context_destroy);
|
g_clear_pointer (&priv->pipewire_context, pw_context_destroy);
|
||||||
g_source_destroy (&priv->pipewire_source->base);
|
g_source_destroy (&priv->pipewire_source->base);
|
||||||
|
g_source_unref (&priv->pipewire_source->base);
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_screen_cast_stream_src_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_screen_cast_stream_src_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user