From 098c8908edf01a515d862bff1e8d37cd227370a9 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 7 May 2014 18:25:58 +0200 Subject: [PATCH] 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 --- src/core/stack-tracker.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c index 751b12963..3cc9c20ba 100644 --- a/src/core/stack-tracker.c +++ b/src/core/stack-tracker.c @@ -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;