panel: Ensure already destroyed panels don't receive callbacks

To prevent sporadic shutdown failures:
```
** Message: 17:08:37.707: Shutting down GNOME Shell

(gnome-shell:91892): Gjs-CRITICAL **: 17:08:37.728: Object .Gjs_ui_panel_Panel (0x5b53524fb030), has been already disposed — impossible to access it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
```

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3601>
This commit is contained in:
Daniel van Vugt 2025-01-17 17:16:08 +08:00
parent 43e39b9d02
commit dee6cf3f6b

View File

@ -678,9 +678,13 @@ class Panel extends St.Widget {
_('Top Bar'), 'shell-focus-top-bar-symbolic',
{sortGroup: CtrlAltTab.SortGroup.TOP});
Main.sessionMode.connect('updated', this._updatePanel.bind(this));
Main.sessionMode.connectObject('updated',
this._updatePanel.bind(this),
this);
global.display.connect('workareas-changed', () => this.queue_relayout());
global.display.connectObject('workareas-changed',
() => this.queue_relayout(),
this);
this._updatePanel();
}