Skip to content

window: don't wrap a null swapchain buffer - #155

Merged
vaxerski merged 1 commit into
hyprwm:mainfrom
UncleJ4ck:fix-swapchain-null
Nov 13, 2026
Merged

vaxerski merged 1 commit into
hyprwm:mainfrom
UncleJ4ck:fix-swapchain-null

Conversation

@UncleJ4ck

Copy link
Copy Markdown
Contributor

resizeSwapchain wraps swapchain->next(nullptr) in a CWaylandBuffer without checking it. next() is null when the swapchain can't allocate (a software renderer with no dmabuf), and the ctor dereferences it, so the app segfaults on the first configure instead of failing cleanly. Leave the slot empty instead; render() and onPreRender both already bail when a buffer is missing.

@erickbatistaprado diagnosed this in #144 (QEMU virtio, no virgl, kms_swrast) and pointed at the exact fix. I couldn't repro the alloc failure on real hardware here (the gpu allocates), so this is compile-tested plus the normal path is unchanged by construction (the new branch only runs when next() is null). A confirm from the software-renderer setup would be good.

Fixes #144.

resizeSwapchain wrapped swapchain->next() in a CWaylandBuffer without checking it.
next() is null when the swapchain can't allocate (a software renderer with no dmabuf),
and the ctor dereferences it, so the app segfaults on first configure. Leave the slot
empty instead; render() and onPreRender already bail when a buffer is missing.
@vaxerski
vaxerski merged commit fa61bbc into hyprwm:main Nov 13, 2026
6 checks passed
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.

SIGSEGV in CWaylandBuffer when the swapchain cannot allocate a buffer (resizeSwapchain ignores failure)

2 participants