[mutter] MetaStackTracker: make sure all stack ops are freed eventually



commit 098c8908edf01a515d862bff1e8d37cd227370a9
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed May 7 18:25:58 2014 +0200

    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 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
index 751b129..3cc9c20 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]