diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2020-03-05 23:29:26 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2020-03-09 17:31:23 +0000 |
commit | 26e1e495a05512a67a14fd23f4732670b582f3bd (patch) | |
tree | a2807daab055ed606876d0db8819868dbf549084 | |
parent | 480e7d44bef3921ebdd9a4e14a2c0e9d112531bd (diff) | |
download | mutter-26e1e495a05512a67a14fd23f4732670b582f3bd.tar.gz |
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
-rw-r--r-- | src/backends/meta-screen-cast-stream-src.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c index 170f34043..4f3d821ef 100644 --- a/src/backends/meta-screen-cast-stream-src.c +++ b/src/backends/meta-screen-cast-stream-src.c @@ -885,7 +885,7 @@ create_pipewire_source (void) pipewire_source->pipewire_loop = pw_loop_new (NULL); if (!pipewire_source->pipewire_loop) { - g_source_destroy ((GSource *) pipewire_source); + g_source_unref ((GSource *) pipewire_source); 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_context, pw_context_destroy); 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); } |