From b6e2836c1758ccb47fe0cb2a160bfc89cf216493 Mon Sep 17 00:00:00 2001 From: Zander Brown Date: Sat, 28 Oct 2023 04:39:46 +0100 Subject: [PATCH] popupMenu: Use connectObject to disconnect when parent destroyed Currently the handler is leaked, contributing to https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7143 , by using `connectObject` with the `owner` actor we avoid leaking `PopupMenuManager`s for things like the password entry in `AuthenticationDialog` Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7143 --- js/ui/popupMenu.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index b2a3c4a48..71049b430 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -1276,7 +1276,7 @@ export class PopupMenuManager { constructor(owner, grabParams) { this._grabParams = Params.parse(grabParams, {actionMode: Shell.ActionMode.POPUP}); - global.stage.connect('notify::key-focus', () => { + global.stage.connectObject('notify::key-focus', () => { if (!this.activeMenu) return; @@ -1285,7 +1285,7 @@ export class PopupMenuManager { if (newMenu) this._changeMenu(newMenu); - }); + }, owner); this._menus = []; }