[mutter/gnome-42] display: Properly store later ID when adding window to queue



commit db52c904eed2056af8c4eba3084f63c2a156a07b
Author: Sebastian Keller <skeller gnome org>
Date:   Fri May 13 19:08:31 2022 +0200

    display: Properly store later ID when adding window to queue
    
    The code is already trying to avoid creating new laters when there
    already is one for the queue type, but this wasn't working because the
    ID of the later was never stored after creating a new one. This would
    then result in as many laters as meta_display_queue_window() was called
    and all of them would run the handler function, even if only the first
    one had a non-empty window queue.
    
    Similarly this was causing the later to not be removed if the window
    queue got empty after meta_display_unqueue_window().
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2414>
    (cherry picked from commit bc9762eebb1ab0b812118dd126b9a9b5c031bec8)

 src/core/display.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 590df83a1c..66b75b1e91 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -4108,10 +4108,11 @@ meta_display_queue_window (MetaDisplay   *display,
           run_data = g_new0 (MetaQueueRunData, 1);
           run_data->display = display;
           run_data->queue_idx = queue_idx;
-          meta_laters_add (laters,
-                           window_queue_later_when[queue_idx],
-                           window_queue_run_later_func,
-                           run_data, g_free);
+          priv->queue_later_ids[queue_idx] =
+            meta_laters_add (laters,
+                             window_queue_later_when[queue_idx],
+                             window_queue_run_later_func,
+                             run_data, g_free);
         }
     }
 }


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