From 19c986c0c6e0aa08ae76ab7d992fbf70ae5e44a0 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 7 Jun 2011 14:25:17 +0100 Subject: [PATCH] actor: Avoid queueing redraws during destruction If an actor or the stage to which it belongs are being destroyed then there is no point in queueing a redraw that will not be seen anyway. Bailing out early also avoids the case in which a redraw is queued during destruction wil cause redraw entries will be added to the Stage, which will take references on it and cause the Stage never to be finalized. http://bugzilla.clutter-project.org/show_bug.cgi?id=2652 --- clutter/clutter-actor.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 6218277ff..49b2a5879 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -5385,17 +5385,13 @@ _clutter_actor_queue_redraw_full (ClutterActor *self, ClutterPaintVolume *volume, ClutterEffect *effect) { + ClutterActorPrivate *priv = self->priv; ClutterPaintVolume allocation_pv; - ClutterActorPrivate *priv; ClutterPaintVolume *pv; gboolean should_free_pv; ClutterActor *stage; gboolean was_dirty; - g_return_if_fail (CLUTTER_IS_ACTOR (self)); - - priv = self->priv; - /* Here's an outline of the actor queue redraw mechanism: * * The process starts in one of the following two functions which @@ -5465,12 +5461,20 @@ _clutter_actor_queue_redraw_full (ClutterActor *self, * paint. */ + /* ignore queueing a redraw for actors being destroyed */ + if (CLUTTER_ACTOR_IN_DESTRUCTION (self)) + return; + stage = _clutter_actor_get_stage_internal (self); - /* Ignore queuing a redraw for actors not descended from a stage */ + /* Ignore queueing a redraw for actors not descended from a stage */ if (stage == NULL) return; + /* ignore queueing a redraw on stages that are being destroyed */ + if (CLUTTER_ACTOR_IN_DESTRUCTION (stage)) + return; + if (flags & CLUTTER_REDRAW_CLIPPED_TO_ALLOCATION) { ClutterActorBox allocation_clip; @@ -5581,6 +5585,8 @@ _clutter_actor_queue_redraw_full (ClutterActor *self, void clutter_actor_queue_redraw (ClutterActor *self) { + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + _clutter_actor_queue_redraw_full (self, 0, /* flags */ NULL, /* clip volume */