Skip to content

Fix the overlay crashing the program on Wayland - #9

Open
raman78 wants to merge 1 commit into
AnotherNathan:masterfrom
raman78:fix/overlay-zero-size
Open

Fix the overlay crashing the program on Wayland#9
raman78 wants to merge 1 commit into
AnotherNathan:masterfrom
raman78:fix/overlay-zero-size

Conversation

@raman78

@raman78 raman78 commented Jul 26, 2026

Copy link
Copy Markdown

What & why

Switching the overlay on crashes the program on Wayland. OverlayInner::current_size starts at Vec2::ZERO, so the deferred viewport is first built with an inner size of 0x0, and Wayland rejects a 0x0 xdg_surface geometry. The wgpu surface is then left unconfigured:

xdg_surface#93: error -1: invalid window geometry size (0x0)
Protocol error 4294967295 on object xdg_surface@93
[WARN] Dropped frame with error: Lost
[ERROR] eframe crashed: winit EventLoopError: Exit Failure: 1

X11 and Windows clamp the size silently, so it only shows up on Wayland.

The change

current_size now starts at the same 240x80 that is passed to with_min_inner_size when the viewport is built a few lines below. The overlay resizes itself to its content on the first frame, so this only affects the very first size.

Reproduced and verified on KDE/Wayland.

Relation to #6

This is a subset of #6 — the exact same four lines are in that branch too, because #6 replaces the overlay with a layer-shell surface on Linux and needed the same fix along the way.

Nothing has to be coordinated between the two: merge either one and the crash is gone, merge both and the change is identical. This is here on its own so the crash can be fixed cheaply without deciding on the much larger layer-shell change. If you merge #6, just close this PR.

OverlayInner.current_size started at Vec2::ZERO, so the deferred
viewport was first built with an inner size of 0x0. Wayland rejects a
0x0 xdg_surface geometry ("invalid window geometry size (0x0)"), which
leaves the wgpu surface unconfigured and panics with "Surface is not
configured for presentation". X11 and Windows silently clamp the size,
so the crash only shows on Wayland.

Initialize current_size to the same min_inner_size (240x80) used when
building the viewport. The overlay still resizes itself to its content
on the first frame, so this only affects the very first size.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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