Repository navigation
steamcompmgr: clear destroyed XDG external overlay from connector and global focus - #2487
Merged
matte-schwartz merged 1 commit intoOct 23, 2026
Conversation
… global focus When an XDG-type external overlay client (such as a zwlr_layer_surface_v1 overlay or HUD) terminates abruptly without orderly cleanup, steamcompmgr_check_xdg removes the window from wlserver.xdg_wins and clears stale XDG window references across g_VirtualConnectorFocuses, but skips externalOverlayWindow. Additionally, steamcompmgr_xdg_determine_and_apply_focus does not reset g_steamcompmgr_xdg_focus.overlayWindow or externalOverlayWindow to nullptr before rescanning active windows. As a result, pFocus->externalOverlayWindow and g_steamcompmgr_xdg_focus retain dangling pointers to the deallocated window. Subsequent compositor paint passes (paint_all -> paint_window) dereference the freed window in window_last_done_commit_index, triggering a SIGSEGV crash. Clear externalOverlayWindow alongside the other focus windows in steamcompmgr_check_xdg, and reset overlay pointers in steamcompmgr_xdg_determine_and_apply_focus and g_steamcompmgr_xdg_focus when XDG windows are marked dirty. Closes: ValveSoftware#2434 Co-authored-by: Antigravity <antigravity@google.com>
sashakosti
force-pushed
the
fix/layer-shell-external-overlay-disconnect
branch
from
October 22, 2026 00:47
6c9b8a8 to
16f685c
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.
Summary
Fixes a crash (
SIGSEGVinwindow_last_done_commit_indexduringpaint_all) when an XDG-type external overlay client (such as azwlr_layer_surface_v1overlay, HUD, or background client) disconnects or is abruptly terminated without an orderly protocol teardown.Problem
In
src/steamcompmgr.cpp:pFocus->externalOverlayWindowindestroy_win(), but that function only handles X11/XWayland windows.steamcompmgr_check_xdg(). Whenwlserver_xdg_dirty()is true,steamcompmgr_check_xdg()clears stale window references acrossg_VirtualConnectorFocuses, but omittedexternalOverlayWindow.steamcompmgr_xdg_determine_and_apply_focus()never resetsg_steamcompmgr_xdg_focus.overlayWindoworexternalOverlayWindowtonullptrbefore iterating active windows, causing stale references to persist if the disconnected window was the only overlay.paint_all()->paint_window(),externalOverlayis dereferenced after the window has already been deallocated, triggering a crash:Solution
steamcompmgr_check_xdg():pFocus->externalOverlayWindowiftype == steamcompmgr_win_type_t::XDG.g_steamcompmgr_xdg_focus.focusWindow,overlayWindow, andexternalOverlayWindowiftype == steamcompmgr_win_type_t::XDG.steamcompmgr_xdg_determine_and_apply_focus():g_steamcompmgr_xdg_focus.overlayWindowandexternalOverlayWindowtonullptrprior to scanning active windows.Tested by spawning a layer-shell overlay client (
swaybg) into a running gamescope session presentingvkcube, sendingSIGKILLto the overlay client, and verifying that gamescope remains fully stable with no crashes.Closes #2434