Avoid crashing when an actor not parented to a toplevel is cloned

If we can't realize the source actor for a clone, simply skip updating
the map state and painting it.

https://bugzilla.gnome.org/show_bug.cgi?id=745517
This commit is contained in:
Owen W. Taylor 2015-09-29 14:15:16 -04:00
parent 86a65ddffc
commit 76c8cd292e
2 changed files with 14 additions and 4 deletions

View File

@ -15938,7 +15938,11 @@ _clutter_actor_set_enable_paint_unmapped (ClutterActor *self,
*/
clutter_actor_realize (self);
clutter_actor_update_map_state (self, MAP_STATE_MAKE_MAPPED);
/* If the actor isn't ultimately connected to a toplevel, it can't be
* realized or painted.
*/
if (CLUTTER_ACTOR_IS_REALIZED (self))
clutter_actor_update_map_state (self, MAP_STATE_MAKE_MAPPED);
}
else
{

View File

@ -184,9 +184,15 @@ clutter_clone_paint (ClutterActor *actor)
was_unmapped = TRUE;
}
_clutter_actor_push_clone_paint ();
clutter_actor_paint (priv->clone_source);
_clutter_actor_pop_clone_paint ();
/* If the source isn't ultimately parented to a toplevel, it can't be
* realized or painted.
*/
if (clutter_actor_is_realized (priv->clone_source))
{
_clutter_actor_push_clone_paint ();
clutter_actor_paint (priv->clone_source);
_clutter_actor_pop_clone_paint ();
}
if (was_unmapped)
_clutter_actor_set_enable_paint_unmapped (priv->clone_source, FALSE);