Window constructor crashes on compositors without fractional-scale, xdg-decoration or viewporter (null globals) #162
Labels
No labels
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Graphics#162
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The
Windowconstructor uses three optional Wayland globals without checking that the compositor advertised them. On a compositor that lacks any one of them the constructor passes a null proxy to libwayland and crashes. Line numbers refer to6aa0338.Details
Device::handle_globalbinds these when they are advertised (implementations/Crafter.Graphics-Device.cpp:277-282), andDevice::Initializeonly verifieswl_shm,wl_compositorandxdg_wm_base(:527):wp_fractional_scale_manager_v1implementations/Crafter.Graphics-Window.cpp:295zxdg_decoration_manager_v1:302wp_viewporter:305The rest of the code half-anticipates this:
Resizealready guardsif (wpViewport)(:544).Found by reading the code. Not reproduced: the compositors at hand (phoc on the Fairphone 6, and the desktop session) advertise all three. The likely first victim is a compositor without xdg-decoration; to my knowledge GNOME's Mutter does not implement it.
Suggested fix
Guard each use and degrade:
wl_output/wl_surface.preferred_buffer_scale, or 1.0;