From 22bb243ec24821cd18e7dba791e793884ffe2a63 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 16 Sep 2009 15:47:26 +0100 Subject: [PATCH] [layout] Replace stale LayoutMeta If a LayoutMeta references a different container and/or layout manager then we should simply replace it and discard the previous one. --- clutter/clutter-layout-manager.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-layout-manager.c b/clutter/clutter-layout-manager.c index b46641265..56b5c5993 100644 --- a/clutter/clutter-layout-manager.c +++ b/clutter/clutter-layout-manager.c @@ -344,7 +344,7 @@ get_child_meta (ClutterLayoutManager *manager, ClutterContainer *container, ClutterActor *actor) { - ClutterLayoutMeta *layout; + ClutterLayoutMeta *layout = NULL; layout = g_object_get_qdata (G_OBJECT (actor), quark_layout_meta); if (layout != NULL) @@ -355,6 +355,21 @@ get_child_meta (ClutterLayoutManager *manager, child->container == container && child->actor == actor) return layout; + + /* if the LayoutMeta referenced is not attached to the + * layout manager then we simply ask the layout manager + * to replace it with the right one + */ + layout = create_child_meta (manager, container, actor); + if (layout != NULL) + { + g_assert (CLUTTER_IS_LAYOUT_META (layout)); + g_object_set_qdata_full (G_OBJECT (actor), quark_layout_meta, + layout, + (GDestroyNotify) g_object_unref); + } + + return layout; } return NULL;