Skip to content

xdg-shell: close a toplevel's taskbar handles when its client disconnects - #245

Open
sachahjkl wants to merge 1 commit into
bea4dev:mainfrom
sachahjkl:fix/foreign-toplevel-on-client-exit
Open

sachahjkl wants to merge 1 commit into
bea4dev:mainfrom
sachahjkl:fix/foreign-toplevel-on-client-exit

Conversation

@sachahjkl

Copy link
Copy Markdown
Contributor

Problem

When a client disconnects, its surfaces die at once, but toplevel_destroyed runs only at the next dispatch. If space.refresh() runs between the two, it drops the dead window from the space. toplevel_destroyed looked for the window in space.elements(), did not find it, and took the early path. The window's foreign-toplevel handles were never closed. A taskbar kept a ghost button (and a thumbnail) for a program that had exited.

Fix

  • state.rs: new field xdg_toplevel_windows: Vec<Window>, a registry of every xdg toplevel's window from new_toplevel to toplevel_destroyed.
  • handlers/xdg_shell.rs: new_toplevel pushes the window into the registry. toplevel_destroyed takes the window out of the registry (take_xdg_toplevel_window) instead of searching the space, so the normal close path runs: taskbar handles, decoration state and the runtime entry are removed. The early path remains for a surface that is not in the registry.

Tests

No test is added.

cargo test --workspace passes, except two tests that also fail on upstream main in our environment: evaluator::tests::embedded_runtime_ipc_does_not_leak_fds_across_reloads and input_method_keyboard_grab_gets_the_keymap_of_the_keys_it_is_sent.

This change has been running daily in the author's own session (a Windows-7-like desktop on ShojiWM).

…vel_destroyed finds the window in a registry of toplevels, not in the space, which refresh() may have emptied of it first

This branch has not been deployed

No deployments
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