diff --git a/extension.js b/extension.js index 1341401..5a89b73 100644 --- a/extension.js +++ b/extension.js @@ -65,7 +65,9 @@ export default class ForgeExtension extends Extension { this.keybindings?.disable(); this.keybindings = null; this.extWm = null; - this.themeWm = null; + // The field assigned in enable() is `this.theme`, not `this.themeWm`, + // so the previous statement was a no-op leaving `this.theme` dangling. + this.theme = null; this.configMgr = null; this.settings = null; this.kbdSettings = null; diff --git a/lib/extension/indicator.js b/lib/extension/indicator.js index 309dcf2..0d06f5e 100644 --- a/lib/extension/indicator.js +++ b/lib/extension/indicator.js @@ -118,7 +118,10 @@ export class FeatureIndicator extends SystemIndicator { this._indicator.visible = tilingModeEnabled && quickSettingsEnabled; - this.extension.settings.connect("changed", (_, name) => { + // settings is a long-lived Gio.Settings (cached by getSettings()) so we + // must disconnect on destroy — otherwise every enable/disable cycle + // accumulates another handler firing on the previous indicator. + this._settingsChangedId = this.extension.settings.connect("changed", (_, name) => { switch (name) { case "tiling-mode-enabled": case "quick-settings-enabled": @@ -126,4 +129,12 @@ export class FeatureIndicator extends SystemIndicator { } }); } + + destroy() { + if (this._settingsChangedId) { + this.extension.settings.disconnect(this._settingsChangedId); + this._settingsChangedId = 0; + } + super.destroy(); + } }