From 009eafb9ee1ea3b6e969b95f219e3f607c10f7e9 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sat, 6 Jun 2009 11:56:08 -0400 Subject: [PATCH] Handle a clone of an actor with an unmapped parent If we are cloning an source actor with an unmapped parent, then when we temporarily map the source actor: - We need to skip the check that a mapped actor has a mapped parent. - We need to realize the actor's parents before mapping it, or we'll get an assertion failure in clutter_actor_update_map_state() because an actor with an unmapped parent is !may_be_realized. http://bugzilla.openedhand.com/show_bug.cgi?id=1633 Signed-off-by: Emmanuele Bassi --- clutter/clutter-actor.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 633ed4934..5257b746e 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -574,19 +574,19 @@ clutter_actor_verify_map_state (ClutterActor *self) } else { - ClutterActor *parent = priv->parent_actor; + ClutterActor *iter = self; - /* check for the enable_paint_unmapped flag on any of the - * parents; if the flag is enabled at any point of this + /* check for the enable_paint_unmapped flag on the actor + * and parents; if the flag is enabled at any point of this * branch of the scene graph then all the later checks * become pointless */ - while (parent != NULL) + while (iter != NULL) { - if (parent->priv->enable_paint_unmapped) + if (iter->priv->enable_paint_unmapped) return; - parent = parent->priv->parent_actor; + iter = iter->priv->parent_actor; } if (!CLUTTER_ACTOR_IS_VISIBLE (priv->parent_actor)) @@ -8568,9 +8568,19 @@ _clutter_actor_set_enable_paint_unmapped (ClutterActor *self, priv->enable_paint_unmapped = enable; if (priv->enable_paint_unmapped) - clutter_actor_update_map_state (self, MAP_STATE_MAKE_MAPPED); + { + /* Make sure that the parents of the widget are realized first; + * otherwise checks in clutter_actor_update_map_state() will + * fail. + */ + clutter_actor_realize (self); + + clutter_actor_update_map_state (self, MAP_STATE_MAKE_MAPPED); + } else - clutter_actor_update_map_state (self, MAP_STATE_MAKE_UNMAPPED); + { + clutter_actor_update_map_state (self, MAP_STATE_MAKE_UNMAPPED); + } } static void