When unparenting an actor, remove queued redraws for all descendants

We need to make sure that redraws queued for actors on a stage are for
actors actually in the stage. So in clutter_actor_unparent() descend
through the children and remove redraws. Just removing the actor itself
isn't good enough since an entire hierarchy can be removed from the
stage without breaking it up into individual actors.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2359

This is based on an original patch from Owen Taylor who debugged the
root cause of this bug; thanks.
This commit is contained in:
Robert Bragg 2010-10-14 16:19:55 +01:00
parent 07f2dba7e2
commit f456116c18

View File

@ -7646,6 +7646,18 @@ clutter_actor_get_paint_visibility (ClutterActor *actor)
return CLUTTER_ACTOR_IS_MAPPED (actor);
}
static gboolean
invalidate_queue_redraw_entry (ClutterActor *self,
void *user_data)
{
ClutterActorPrivate *priv = self->priv;
if (priv->queue_redraw_entry)
_clutter_stage_queue_redraw_entry_invalidate (priv->queue_redraw_entry);
return TRUE;
}
/**
* clutter_actor_unparent:
* @self: a #ClutterActor
@ -7673,11 +7685,13 @@ 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 since we won't be able to determine the
* appropriate stage after this. */
if (priv->queue_redraw_entry)
_clutter_stage_queue_redraw_entry_invalidate (priv->queue_redraw_entry);
/* 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);
was_mapped = CLUTTER_ACTOR_IS_MAPPED (self);