Skip to content

WaylandBackend: fix Wayland protocol violation and reuse cursor surface - #2441

Open
connormclaud wants to merge 1 commit into
ValveSoftware:masterfrom
connormclaud:fix-wayland-cursor-protocol
Open

connormclaud wants to merge 1 commit into
ValveSoftware:masterfrom
connormclaud:fix-wayland-cursor-protocol

Conversation

@connormclaud

Copy link
Copy Markdown

Upstream CWaylandBackend prematurely destroyed wl_buffer objects
immediately after surface commit via defer(wl_buffer_destroy(pBuffer)),
violating the wl_surface.attach and wl_buffer specifications in wayland.xml.
When the host compositor processes the commit, the buffer resource is
already invalid, triggering runtime check failures in GNOME Shell:
meta_wayland_cursor_surface_constructed: runtime check failed: (!buffer || buffer->resource)

Additionally, CWaylandBackend was destroying and re-allocating the
wl_surface on every cursor frame update, causing surface role churn
for animated cursors.

This patch:

  1. Implements a wl_buffer_listener that defers wl_buffer_destroy until
    the host compositor issues a wl_buffer.release event.
  2. Allows CursorInfoToSurface to take an existing wl_surface, reusing
    the surface across cursor updates rather than reallocating.

Relates to #2432

@connormclaud
connormclaud marked this pull request as ready for review September 26, 2026 20:50
Upstream CWaylandBackend prematurely destroyed wl_buffer objects
immediately after surface commit via defer(wl_buffer_destroy(pBuffer)),
violating the wl_surface.attach and wl_buffer specifications in wayland.xml.
When the host compositor processes the commit, the buffer resource is
already invalid, triggering runtime check failures in GNOME Shell:
  meta_wayland_cursor_surface_constructed: runtime check failed: (!buffer || buffer->resource)

Additionally, CWaylandBackend was destroying and re-allocating the
wl_surface on every cursor frame update, causing surface role churn
for animated cursors.

This patch:
1. Implements a wl_buffer_listener that defers wl_buffer_destroy until
   the host compositor issues a wl_buffer.release event.
2. Allows CursorInfoToSurface to take an existing wl_surface, reusing
   the surface across cursor updates rather than reallocating.

Relates to ValveSoftware#2432
@connormclaud
connormclaud force-pushed the fix-wayland-cursor-protocol branch from 0aef1ec to 7bb10fc Compare October 6, 2026 17:16
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.

2 participants