[mutter] clutter/actor: Disconnect from "layout-changed" signal on destroy
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/actor: Disconnect from "layout-changed" signal on destroy
- Date: Mon, 8 Jun 2020 17:39:35 +0000 (UTC)
commit 90c20b185be16d111636ce6176d83d36e76cfd53
Author: Jonas Dreßler <verdre v0yd nl>
Date: Tue Jun 2 14:28:59 2020 +0200
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 a4509cf1ff..df6b14338f 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]