Repository navigation
fix: tear down and release the panel and dock on rebuild - #53
Merged
mirkobrombin merged 2 commits intoNov 29, 2026
Merged
mirkobrombin merged 2 commits into
mirkobrombin merged 2 commits into
Conversation
Moving the shell to another display rebuilds the panel and dock. In GTK4 destroy() only hides a window and drops it from the toplevel list; dispose() waits for the last reference, and the signal closures that capture the panel and dock keep them alive. Their cleanup lived in dispose(), so it never ran: the replaced surfaces kept answering fullscreen and focus signals and presented themselves again when a fullscreen window closed, leaving one extra panel and dock on screen per earlier move. Run the teardown from destroy(), disconnect the panel's AppSystem, HomeCover and wallpaper handlers there, and refuse to show a panel or dock that is no longer in the toplevel list. Assisted-by: Claude:claude-fable-5-2 AI-Scope: diagnosis from shell logs and a temporary show/map probe; destroy-time teardown and show guard in panel, dock and layer_window
A panel or dock that was destroyed for a rebuild was never freed. Lambdas connected on shared services held it, its own widgets and event controllers held it through their handlers, and the dock's motion hints held it through their alias callback. Each move of the shell to another display left one more of each in memory, still reacting to settings, network, audio and power changes. The dock also created a D-Bus service per instance. The first one kept the dev.sinty.Dock object path, so every later dock failed to register and apps kept talking to the service of a dock that was gone. Collect the handlers connected on outside objects in a SignalBag and disconnect them in the teardown, drop the motion hints there, and dispose the window tree once destroy() has returned. Make the dock D-Bus service one shared instance, so the registration happens once and the suffixes, icons and menus apps set survive a rebuild. Checked in a headless session with two outputs: ten moves of the shell between them release ten docks and nine panels with no GTK criticals. The newest replaced panel is still held until the following rebuild. Assisted-by: Claude:claude-fable-5-2 AI-Scope: leak analysis, SignalBag and window tree release helpers, handler tracking in panel and dock, shared dock D-Bus service; tested in a headless labwc session
BlakeGardner
force-pushed
the
fix/release-replaced-shell-surfaces
branch
from
November 29, 2026 17:30
7a0c200 to
c63af34
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Moving the dock to another display in Settings → Displays rebuilds the panel
and dock, and the old ones are never cleaned up:
DockDBusService register_object failed. The first dock keeps thedev.sinty.Dockobject path, so apps setting badges, icons or menus over D-Bus keep talking to a dock that is gone.Video of the issue
https://www.youtube.com/watch?v=Nr3IGMWpyKE
Cause
In GTK4,
destroy()only hides a window and drops it from the toplevel list.dispose()waits for the last reference, and the panel and dock are keptalive by their own signal handlers. Their cleanup lived in
dispose(), so itnever ran.
Commit 1 — tear down on destroy
destroy().This alone fixes the ghost bars and docks.
Commit 2 — release what was replaced
DockDBusServicefor the session. It registers once, and whatapps set survives a rebuild.
SignalBagand aredisconnected at teardown.
destroy()returns, the window tree is disposed, which breaks thereference loops through the surface's own widgets and controllers.
Generative AI assistance
AI assistance: disclosed