From 76c8cd292ed269bd75e7482d96fd4209076d2266 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Tue, 29 Sep 2015 14:15:16 -0400 Subject: [PATCH] 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 --- clutter/clutter-actor.c | 6 +++++- clutter/clutter-clone.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index ad106c452..53c1354f0 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -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 { diff --git a/clutter/clutter-clone.c b/clutter/clutter-clone.c index a84c7feaa..eb91915c3 100644 --- a/clutter/clutter-clone.c +++ b/clutter/clutter-clone.c @@ -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);