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
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2178>
This commit is contained in:
Carlos Garnacho 2022-02-13 14:05:41 +01:00 committed by Marge Bot
parent 57d681863a
commit 89db7bbb12

View File

@ -994,10 +994,16 @@ var PopupDummyMenu = class {
} }
open() { open() {
if (this.isOpen)
return;
this.isOpen = true;
this.emit('open-state-changed', true); this.emit('open-state-changed', true);
} }
close() { close() {
if (!this.isOpen)
return;
this.isOpen = false;
this.emit('open-state-changed', false); this.emit('open-state-changed', false);
} }