From d67ba3ea65717ceab3e0c91267191c6ed2aac2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 10 Jul 2020 09:06:33 +0200 Subject: [PATCH] screen-cast/src: Remove follow up timeout source on disable We failed to remove the timeout source when disabling, meaning that if a follow up was scheduled, and shortly after we disabled the source, the timeout would be invoked after the source was freed causing use-after-free bugs. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1337 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1365 --- src/backends/meta-screen-cast-stream-src.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c index 74df526db..a0ba05ea5 100644 --- a/src/backends/meta-screen-cast-stream-src.c +++ b/src/backends/meta-screen-cast-stream-src.c @@ -618,6 +618,8 @@ meta_screen_cast_stream_src_disable (MetaScreenCastStreamSrc *src) META_SCREEN_CAST_STREAM_SRC_GET_CLASS (src)->disable (src); + g_clear_handle_id (&priv->follow_up_frame_source_id, g_source_remove); + priv->is_enabled = FALSE; }