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
This commit is contained in:
Chris Lord 2011-03-28 16:10:59 +01:00 committed by Emmanuele Bassi
parent 5aa8ed93ce
commit f9d7650b97

View File

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