f1b7af2ab0
PopupMenuManager was connecting to notify::key-focus on the stage on construction, but only ever reacting to it when one of its menus was open. Given that every single app icon and text entry creates a PopupMenuManager this was causing a lot of these handlers to be created. Every single handler meant calling into JS code only for the vast majority of them to determine that they would not do anything. Additionally these handlers were leaked for the whole lifetime of the stage due to never getting disconnected. This now only connects the handler when a menu is open and disconnects again when it is closed, significantly reducing the number of active handlers at a time. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7143 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3001>