Skip to content

wlr-layer-shell: skip pre-commit validation for destroyed surfaces - #2071

Open
BVMiko wants to merge 1 commit into
Smithay:masterfrom
BVMiko:fix/destroyed_layer_surface_hook
Open

wlr-layer-shell: skip pre-commit validation for destroyed surfaces#2071
BVMiko wants to merge 1 commit into
Smithay:masterfrom
BVMiko:fix/destroyed_layer_surface_hook

Conversation

@BVMiko

@BVMiko BVMiko commented Jun 15, 2026

Copy link
Copy Markdown

Description

I hit an issue while using gtk4-layer-shell: the client gets disconnected the moment it hides a layer-shell window.

To hide a window, gtk4-layer-shell destroys the zwlr_layer_surface_v1 and then commits the wl_surface (with a nil buffer).
On destroy the cached layer state is reset to defaults (size 0, no anchors), but the pre-commit hook is still attached to the surface, so that commit runs it. The state now matches the pending.size.w == 0 && !pending.anchor.anchored_horizontally() check, which posts InvalidSize ("width 0 requested without setting left and right anchors") and takes down the whole client.

This PR just skips the pre-commit validation once the zwlr_layer_surface_v1 has been destroyed. It only short-circuits the hook; it doesn't affect how the surface is torn down.

Checklist

@Drakulix

Copy link
Copy Markdown
Member

This PR just skips the pre-commit validation once the zwlr_layer_surface_v1 has been destroyed. It only short-circuits the hook; it doesn't affect how the surface is torn down.

Hmm, I am not sure this is fully correct. We obviously don't want to validate any state that would be specific to the layer-surface (like geometry or anchors), but attaching a null buffer actually has an effect further down the commit hook, which is resetting the unmapped surface for another initial configure.

Arguably gtk4-layer-shell should really send the unmap (null-buffer commit) before destroying the surface, but we can work-around it.

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