From d1ca0e1b8f3dc6f5b5fec0ce3fba4702b9e75386 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 24 Feb 2010 12:23:46 +0000 Subject: [PATCH] fixed layout: Store a back pointer to the Container When set_container() is called with a NULL container we cannot use the passed pointer to unset the CLUTTER_ACTOR_NO_LAYOUT flag. We should store a back pointer to the container as object data (there's no need to add a Private data structure in this case) and unset the flag on the back pointer instead. --- clutter/clutter-fixed-layout.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/clutter/clutter-fixed-layout.c b/clutter/clutter-fixed-layout.c index d87d29216..2df24ebae 100644 --- a/clutter/clutter-fixed-layout.c +++ b/clutter/clutter-fixed-layout.c @@ -156,8 +156,10 @@ void clutter_fixed_layout_set_container (ClutterLayoutManager *manager, ClutterContainer *container) { - if (container) + if (container != NULL) { + g_object_set_data (G_OBJECT (manager), "fixed-container", container); + /* signal Clutter that we don't impose any layout on * our children, so we can shave off some relayout * operations @@ -165,7 +167,15 @@ clutter_fixed_layout_set_container (ClutterLayoutManager *manager, CLUTTER_ACTOR_SET_FLAGS (container, CLUTTER_ACTOR_NO_LAYOUT); } else - CLUTTER_ACTOR_UNSET_FLAGS (container, CLUTTER_ACTOR_NO_LAYOUT); + { + gpointer old_container; + + old_container = g_object_get_data (G_OBJECT (manager), "fixed-container"); + if (old_container != NULL) + CLUTTER_ACTOR_UNSET_FLAGS (old_container, CLUTTER_ACTOR_NO_LAYOUT); + + g_object_set_data (G_OBJECT (manager), "fixed-container", NULL); + } } static void