MetaStackTracker: make sure all stack ops are freed eventually

If we apply a prediction immediately instead of queueing, we should
also free the operation immediately.
If we discard the prediction queue because we resync fully, we
need to free each operation too.

https://bugzilla.gnome.org/show_bug.cgi?id=729732
This commit is contained in:
Giovanni Campagna 2014-05-07 18:25:58 +02:00
parent ab632e36a5
commit 098c8908ed

View File

@ -541,6 +541,8 @@ static void
stack_tracker_apply_prediction (MetaStackTracker *tracker,
MetaStackOp *op)
{
gboolean free_at_end = FALSE;
/* If this is a wayland operation then it's implicitly verified so
* we can apply it immediately so long as it doesn't depend on any
* unverified X operations...
@ -550,6 +552,8 @@ stack_tracker_apply_prediction (MetaStackTracker *tracker,
{
if (meta_stack_op_apply (op, tracker->verified_stack))
meta_stack_tracker_queue_sync_stack (tracker);
free_at_end = TRUE;
}
else
{
@ -561,6 +565,9 @@ stack_tracker_apply_prediction (MetaStackTracker *tracker,
meta_stack_op_apply (op, tracker->predicted_stack))
meta_stack_tracker_queue_sync_stack (tracker);
if (free_at_end)
meta_stack_op_free (op);
meta_stack_tracker_dump (tracker);
}
@ -895,7 +902,10 @@ resync_verified_stack_with_xserver_stack (MetaStackTracker *tracker)
requery_xserver_stack (tracker);
for (l = tracker->unverified_predictions->head; l; l = l->next)
meta_stack_op_apply (l->data, tracker->verified_stack);
{
meta_stack_op_apply (l->data, tracker->verified_stack);
meta_stack_op_free (l->data);
}
g_queue_clear (tracker->unverified_predictions);
j = 0;