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
This commit is contained in:
Emmanuele Bassi 2011-06-07 14:25:17 +01:00
parent 835fc2381c
commit 19c986c0c6

View File

@ -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 */