From 90c20b185be16d111636ce6176d83d36e76cfd53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Tue, 2 Jun 2020 14:28:59 +0200 Subject: [PATCH] clutter/actor: Disconnect from "layout-changed" signal on destroy While the layout manager of a ClutterActor does get properly unset when destroying an actor, we currently forget to disconnect the "layout-changed" signal from it. So do that, and while at it, also switch to using the signal id for disconnecting from the signal instead of g_signal_handlers_disconnect_by_func(), which caused problems before because it might traverse the signal handler list. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1281 --- clutter/clutter/clutter-actor.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index a4509cf1f..df6b14338 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -811,6 +811,7 @@ struct _ClutterActorPrivate gulong resolution_changed_id; gulong font_changed_id; + gulong layout_changed_id; /* bitfields: KEEP AT THE END */ @@ -6062,6 +6063,7 @@ clutter_actor_dispose (GObject *object) if (priv->layout_manager != NULL) { + g_clear_signal_handler (&priv->layout_changed_id, priv->layout_manager); clutter_layout_manager_set_container (priv->layout_manager, NULL); g_clear_object (&priv->layout_manager); } @@ -17971,9 +17973,7 @@ clutter_actor_set_layout_manager (ClutterActor *self, if (priv->layout_manager != NULL) { - g_signal_handlers_disconnect_by_func (priv->layout_manager, - G_CALLBACK (on_layout_manager_changed), - self); + g_clear_signal_handler (&priv->layout_changed_id, priv->layout_manager); clutter_layout_manager_set_container (priv->layout_manager, NULL); g_clear_object (&priv->layout_manager); } @@ -17985,9 +17985,10 @@ clutter_actor_set_layout_manager (ClutterActor *self, g_object_ref_sink (priv->layout_manager); clutter_layout_manager_set_container (priv->layout_manager, CLUTTER_CONTAINER (self)); - g_signal_connect (priv->layout_manager, "layout-changed", - G_CALLBACK (on_layout_manager_changed), - self); + priv->layout_changed_id = + g_signal_connect (priv->layout_manager, "layout-changed", + G_CALLBACK (on_layout_manager_changed), + self); } clutter_actor_queue_relayout (self);