summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2019-04-29 20:02:18 +0000
committerMarco Trevisan <mail@3v1n0.net>2019-05-01 05:11:17 +0000
commit668c44e66bf681ff50c62766ea9d1ca1d0762ec4 (patch)
treecd61807438f3bdcfd9406b8da9859452e4d0d5bc
parent3495a438107e7988bd1a5a089c66fa795a3d5981 (diff)
downloadmutter-668c44e66bf681ff50c62766ea9d1ca1d0762ec4.tar.gz
compositor: Disconnect from stage signals on destruction
From this point there's not any need for the compositor to listen to signals so we can disconnect from the stage ones we are connected to. https://gitlab.gnome.org/GNOME/mutter/merge_requests/556 (cherry picked from commit 3ba79961fed2c70df3201b3e588990c92aadcd7f)
-rw-r--r--src/compositor/compositor-private.h3
-rw-r--r--src/compositor/compositor.c21
2 files changed, 19 insertions, 5 deletions
diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h
index 0f92d42da..6ab33416c 100644
--- a/src/compositor/compositor-private.h
+++ b/src/compositor/compositor-private.h
@@ -18,6 +18,9 @@ struct _MetaCompositor
guint pre_paint_func_id;
guint post_paint_func_id;
+ guint stage_presented_id;
+ guint stage_after_paint_id;
+
gint64 server_time_query_time;
gint64 server_time_offset;
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index f47889f43..2a2c8fb3b 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -135,6 +135,15 @@ meta_switch_workspace_completed (MetaCompositor *compositor)
void
meta_compositor_destroy (MetaCompositor *compositor)
{
+ g_signal_handler_disconnect (compositor->stage,
+ compositor->stage_after_paint_id);
+ g_signal_handler_disconnect (compositor->stage,
+ compositor->stage_presented_id);
+
+ compositor->stage_after_paint_id = 0;
+ compositor->stage_presented_id = 0;
+ compositor->stage = NULL;
+
clutter_threads_remove_repaint_func (compositor->pre_paint_func_id);
clutter_threads_remove_repaint_func (compositor->post_paint_func_id);
@@ -520,9 +529,10 @@ meta_compositor_manage (MetaCompositor *compositor)
compositor->stage = meta_backend_get_stage (backend);
- g_signal_connect (compositor->stage, "presented",
- G_CALLBACK (on_presented),
- compositor);
+ compositor->stage_presented_id =
+ g_signal_connect (compositor->stage, "presented",
+ G_CALLBACK (on_presented),
+ compositor);
/* We use connect_after() here to accomodate code in GNOME Shell that,
* when benchmarking drawing performance, connects to ::after-paint
@@ -532,8 +542,9 @@ meta_compositor_manage (MetaCompositor *compositor)
* connections to ::after-paint, connect() vs. connect_after() doesn't
* matter.
*/
- g_signal_connect_after (CLUTTER_STAGE (compositor->stage), "after-paint",
- G_CALLBACK (after_stage_paint), compositor);
+ compositor->stage_after_paint_id =
+ g_signal_connect_after (compositor->stage, "after-paint",
+ G_CALLBACK (after_stage_paint), compositor);
clutter_stage_set_sync_delay (CLUTTER_STAGE (compositor->stage), META_SYNC_DELAY);