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
This commit is contained in:
Zander Brown 2023-10-28 04:39:46 +01:00
parent fe292ac941
commit b6e2836c17
No known key found for this signature in database
GPG key ID: 25EE3C36E31E5F84

View file

@ -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 = [];
}