[gnome-shell/wip/carlosg/dummy-menu-reentrancy] popupMenu: Avoid open state reentrancy in dummy menus




commit 7af1919c1697143642f9ff06732135a1cda1b1e7
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

 js/ui/popupMenu.js | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index f30c011468..5908f7a295 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -994,10 +994,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]