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
This commit is contained in:
Marco Trevisan (Treviño) 2019-04-29 15:02:18 -05:00
parent 7718e67f5c
commit 3ba79961fe
2 changed files with 19 additions and 5 deletions

View File

@ -18,6 +18,9 @@ struct _MetaCompositor
guint pre_paint_func_id; guint pre_paint_func_id;
guint post_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_query_time;
gint64 server_time_offset; gint64 server_time_offset;

View File

@ -135,6 +135,15 @@ meta_switch_workspace_completed (MetaCompositor *compositor)
void void
meta_compositor_destroy (MetaCompositor *compositor) 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->pre_paint_func_id);
clutter_threads_remove_repaint_func (compositor->post_paint_func_id); clutter_threads_remove_repaint_func (compositor->post_paint_func_id);
@ -520,6 +529,7 @@ meta_compositor_manage (MetaCompositor *compositor)
compositor->stage = meta_backend_get_stage (backend); compositor->stage = meta_backend_get_stage (backend);
compositor->stage_presented_id =
g_signal_connect (compositor->stage, "presented", g_signal_connect (compositor->stage, "presented",
G_CALLBACK (on_presented), G_CALLBACK (on_presented),
compositor); compositor);
@ -532,7 +542,8 @@ meta_compositor_manage (MetaCompositor *compositor)
* connections to ::after-paint, connect() vs. connect_after() doesn't * connections to ::after-paint, connect() vs. connect_after() doesn't
* matter. * matter.
*/ */
g_signal_connect_after (CLUTTER_STAGE (compositor->stage), "after-paint", compositor->stage_after_paint_id =
g_signal_connect_after (compositor->stage, "after-paint",
G_CALLBACK (after_stage_paint), compositor); G_CALLBACK (after_stage_paint), compositor);
clutter_stage_set_sync_delay (CLUTTER_STAGE (compositor->stage), META_SYNC_DELAY); clutter_stage_set_sync_delay (CLUTTER_STAGE (compositor->stage), META_SYNC_DELAY);