Repository navigation
Conversation
When DISPLAY is set but no X server is reachable, AppCreateXlibWindow throws after XOpenDisplay returns null. The error is caught and the extension is skipped, but the teardown loop still calls destroy_window for every surface extension. AppDestroyXlibWindow then passes the null Display to XDestroyWindow and segfaults. Output still buffered in stdout is lost, so a piped or redirected run prints nothing. Record in SurfaceExtension whether create_window succeeded, and only call destroy_window for windows that were created. This covers every platform's teardown rather than adding a null check to one of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
User igouss not on autobuild list. Waiting for curator authorization before starting CI build. |
1 similar comment
|
User igouss not on autobuild list. Waiting for curator authorization before starting CI build. |
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.
I run a Wayland desktop (Hyprland). After its Xwayland socket went away,
DISPLAY=:0still pointed at it, andvulkaninfo --summarystartedsegfaulting at exit. On a terminal the summary prints and then it
crashes; piped or redirected (
vulkaninfo --summary | grep deviceName)it prints nothing, because stdout is still buffered when it crashes.
Any setup where
DISPLAYis set butXOpenDisplayfails takes the samepath. I hit it after Xwayland went away; a stale
DISPLAYover SSH or acontainer with
DISPLAYset and no server should do the same, though Ihaven't tested those.
Cause.
AppCreateXlibWindowthrows whenXOpenDisplayreturns null.The main loop catches that and skips the extension (
vulkaninfo.cpp,the
create_windowtry/catch), but the teardown loop still callsdestroy_windowfor every surface extension, whether or not its windowwas created.
AppDestroyXlibWindowthen callsXDestroyWindow(nullptr, ...). (The XCB path got the equivalent nullcheck in #292.)
Fix.
SurfaceExtensionrecords whethercreate_windowsucceeded,and teardown only calls
destroy_windowfor windows that were created.I fixed it in the loop rather than in
AppDestroyXlibWindowbecause thesame pattern applies to other platforms: from reading the code, DirectFB
and QNX Screen can throw partway through
create_windowand would thenrun their destroy functions on fields that were never set. I could only
build and test the Linux XCB/Xlib/Wayland paths. If you'd rather keep
the change local, a null check in
AppDestroyXlibWindow(matching theexisting one in
AppDestroyXcbWindow) also fixes this crash; I testedthat too and it behaved identically here.
One trade-off: a
create_windowthat throws partway through now leakswhatever it had already allocated (e.g. the DirectFB
dfb, or the QNXcontext) instead of passing it to
destroy_window. The process is aboutto exit, so I preferred that to running destroy on half-initialized
state.
Repro (nothing listening on
:99):Segmentation fault, exit 139 (stdout empty whenredirected); backtrace
XDestroyWindow←AppDestroyXlibWindow.Testing (Arch Linux, Mesa 26.2.5, libX11 1.8.14; Intel UHD 630 +
AMD Radeon R9 200 / HD 7900 Series (RADV TAHITI)), with
VK_LAYER_KHRONOS_validationenabled:
DISPLAY=:99, no X server,--summaryDISPLAY=:99, no X server, full outputDISPLAYunset:99(Xwayland), full and--summaryNo validation messages in any run. With a live X server, output is the
same as main apart from the heap budget value, which varies between
runs. Also reproduced the crash with the Arch
vulkan-tools1.4.363.0-1package.
🤖 Generated with Claude Code