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.
This commit is contained in:
Emmanuele Bassi 2010-02-24 12:23:46 +00:00
parent 3a9d842164
commit d1ca0e1b8f

View File

@ -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