Don't leave stale invalidated queued redraws around

Once an actor had _clutter_stage_queue_redraw_entry_invalidate()
called on it once, then priv->queue_redraw_entry would point to
an entry with entry->actor NULL. _clutter_stage_queue_actor_redraw()
doesn't handle this case and no further redraws would be queued.

To fix this, NULL out priv->queue_redraw_entry() and then make sure
we free the invalidated entry in
_clutter_stage_maybe_finish_queue_redraws() just as we do for
still valid entries.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2389
This commit is contained in:
Owen W. Taylor 2010-10-30 18:11:03 -04:00 committed by Robert Bragg
parent 02a3670e88
commit 0b4b1ca1ca
2 changed files with 11 additions and 6 deletions

View File

@ -7654,7 +7654,10 @@ invalidate_queue_redraw_entry (ClutterActor *self,
ClutterActorPrivate *priv = self->priv;
if (priv->queue_redraw_entry != NULL)
_clutter_stage_queue_redraw_entry_invalidate (priv->queue_redraw_entry);
{
_clutter_stage_queue_redraw_entry_invalidate (priv->queue_redraw_entry);
priv->queue_redraw_entry = NULL;
}
return TRUE;
}

View File

@ -3217,7 +3217,8 @@ _clutter_stage_queue_actor_redraw (ClutterStage *stage,
static void
free_queue_redraw_entry (ClutterStageQueueRedrawEntry *entry)
{
g_object_unref (entry->actor);
if (entry->actor)
g_object_unref (entry->actor);
if (entry->has_clip)
clutter_paint_volume_free (&entry->clip);
g_slice_free (ClutterStageQueueRedrawEntry, entry);
@ -3267,12 +3268,13 @@ _clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage)
ClutterPaintVolume *clip;
/* NB: Entries may be invalidated if the actor gets destroyed */
if (G_UNLIKELY (entry->actor == NULL))
continue;
if (G_LIKELY (entry->actor != NULL))
{
clip = entry->has_clip ? &entry->clip : NULL;
clip = entry->has_clip ? &entry->clip : NULL;
_clutter_actor_finish_queue_redraw (entry->actor, clip);
}
_clutter_actor_finish_queue_redraw (entry->actor, clip);
free_queue_redraw_entry (entry);
}
g_list_free (stolen_list);