Skip to content

fix: disconnect WindowManager settings handler on disable#523

Open
mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
mayconrcmello:fix/disconnect-windowmanager-settings
Open

fix: disconnect WindowManager settings handler on disable#523
mayconrcmello wants to merge 1 commit intoforge-ext:mainfrom
mayconrcmello:fix/disconnect-windowmanager-settings

Conversation

@mayconrcmello
Copy link
Copy Markdown

Summary

Same shape as #521 but in WindowManager._bindSignals(). The extension.settings.connect("changed", …) call doesn't capture the handler id, and _removeSignals() doesn't disconnect it. Because Gio.Settings is cached for the lifetime of the gnome-shell process, the handler outlives every enable/disable cycle — each cycle adds one more, and toggling any setting (tiling-mode-enabled, window-gap-size, focus-border-toggle, …) eventually fires the switch on disposed WindowManager instances.

Fix

  • Store the handler id on this._settingsChangedId at connect time.
  • Disconnect in _removeSignals() alongside the existing display / window_manager / workspace_manager / overview cleanups.

Test plan

  • node --check
  • Repeated gnome-extensions disable forge && gnome-extensions enable forge cycles, then toggling tiling-mode-enabled: settings change runs once per toggle (not N times).
  • No JS ERROR rows in the journal mentioning tree / renderTree after several reload cycles.

Notes

Together with #521, this clears all settings-handler leaks I could find. There's no remaining *.connect("changed" without a paired disconnect after these two PRs.

WindowManager._bindSignals() connects to extension.settings without
storing the id, mirroring the same leak that forge-ext#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().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant