From f456116c18dac24454f9c46b02677a51f79e4052 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 14 Oct 2010 16:19:55 +0100 Subject: [PATCH] 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. --- clutter/clutter-actor.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index ae1912433..9d8618960 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -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);