From 547bb0a353282be33d2e4f12130778b7be43fbb5 Mon Sep 17 00:00:00 2001 From: Maycon Date: Wed, 29 Apr 2026 13:57:49 -0300 Subject: [PATCH] fix: disconnect WindowManager settings handler on disable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WindowManager._bindSignals() connects to extension.settings without storing the id, mirroring the same leak that #521 fixes for FeatureIndicator. Gio.Settings is cached for the lifetime of the gnome-shell process, so each enable/disable cycle accumulates another 'changed' handler firing on prior (disposed) WindowManager instances — toggling tiling-mode-enabled, gap size, focus border, etc. then runs N callbacks against dead objects, each one churning through the settingName switch and eventually faulting in the case branches that touch this.tree / this.theme. Capture the id and disconnect it in _removeSignals(). --- lib/extension/window.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/extension/window.js b/lib/extension/window.js index 61820e1..559b69e 100644 --- a/lib/extension/window.js +++ b/lib/extension/window.js @@ -289,7 +289,7 @@ export class WindowManager extends GObject.Object { let settings = this.ext.settings; - settings.connect("changed", (_, settingName) => { + this._settingsChangedId = settings.connect("changed", (_, settingName) => { switch (settingName) { case "window-overrides-reload-trigger": // Reload window overrides when triggered by preferences @@ -1158,6 +1158,11 @@ export class WindowManager extends GObject.Object { this._overviewSignals = null; } + if (this._settingsChangedId) { + this.ext.settings.disconnect(this._settingsChangedId); + this._settingsChangedId = 0; + } + this._signalsBound = false; }