From f9d7650b97c3788763e14ce3b39f21f19edc41bb Mon Sep 17 00:00:00 2001 From: Chris Lord Date: Mon, 28 Mar 2011 16:10:59 +0100 Subject: [PATCH] actor: Ensure the validity of the queue_redraw_entry pointer In _clutter_actor_queue_redraw_with_clip, there was the possibility that the actor will add itself to the stage's redraw queue without keeping track of the allocated list member. In clutter_actor_unparent, the redraw queue entry was being invalidated before the mapped notify signal was being fired, meaning that queueing a redraw of an unmapped actor in the mapped notification callback could cause a crash. http://bugzilla.clutter-project.org/show_bug.cgi?id=2621 --- clutter/clutter-actor.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 49ef0aaf5..fe97b75ed 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -8239,15 +8239,6 @@ clutter_actor_unparent (ClutterActor *self) if (priv->parent_actor == NULL) return; - /* We take this opportunity to invalidate any queue redraw entry - * associated with the actor and descendants since we won't be able to - * determine the appropriate stage after this. */ - _clutter_actor_traverse (self, - 0, - invalidate_queue_redraw_entry, - NULL, - NULL); - was_mapped = CLUTTER_ACTOR_IS_MAPPED (self); /* we need to unrealize *before* we set parent_actor to NULL, @@ -8258,6 +8249,15 @@ clutter_actor_unparent (ClutterActor *self) */ clutter_actor_update_map_state (self, MAP_STATE_MAKE_UNREALIZED); + /* We take this opportunity to invalidate any queue redraw entry + * associated with the actor and descendants since we won't be able to + * determine the appropriate stage after this. */ + _clutter_actor_traverse (self, + 0, + invalidate_queue_redraw_entry, + NULL, + NULL); + old_parent = priv->parent_actor; priv->parent_actor = NULL;