[gnome-shell/gnome-40] popupMenu: Avoid open state reentrancy in dummy menus



commit 4cccc972f7040199cab5cd9c6a43a9925bf9454f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Feb 13 14:05:41 2022 +0100

    popupMenu: Avoid open state reentrancy in dummy menus
    
    Dummy menus may emit ::open-state-changed multiple times for
    the same state. Avoid doing that so that the PopupMenuManager
    is happy not having to handle reentrancy.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5064
    (cherry picked from commit 89db7bbb120b5874bd94cdeb1992712513281b26)
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2181>

 js/ui/popupMenu.js | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index f9c3df0bf1..ced2ca30c8 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -998,10 +998,16 @@ var PopupDummyMenu = class {
     }
 
     open() {
+        if (this.isOpen)
+            return;
+        this.isOpen = true;
         this.emit('open-state-changed', true);
     }
 
     close() {
+        if (!this.isOpen)
+            return;
+        this.isOpen = false;
         this.emit('open-state-changed', false);
     }
 


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