mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 11:02:05 +00:00
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
This commit is contained in:
parent
4d7c8d68bc
commit
90c20b185b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user