From dee6cf3f6bb22f607946c6d22860d7acec24af11 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 17 Jan 2025 17:16:08 +0800 Subject: [PATCH] panel: Ensure already destroyed panels don't receive callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: --- js/ui/panel.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/ui/panel.js b/js/ui/panel.js index 5872add0c..b8d05634c 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -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(); }