Smithay / smithay

A smithy for rusty wayland compositors
MIT License
1.82k stars 155 forks source link

Compositor panic with `zwlr_layer_surface_v1::set_size(0, 0)` #1089

Open ids1024 opened 1 year ago

ids1024 commented 1 year ago

This can be reproduced by modifying https://github.com/Smithay/client-toolkit/blob/master/examples/simple_layer.rs to use set_size(0, 0) and running it under a compositor like Anvil:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/ian/src/smithay/src/wayland/compositor/tree.rs:275:43
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

That seems like an interesting line to fail on: https://github.com/Smithay/smithay/blob/ae7fb22315a8cf16c33b5468e9d2faaa4390520d/src/wayland/compositor/tree.rs#L275C13-L275C52

It should generate a protocol error in this particular case, with 0 as the size in both dimensions but an anchor in only one. Need to make sure it generates that, and also correctly handles 0 where it is valid.

ids1024 commented 1 year ago

Seems to panic using set_anchor(Anchor::BOTTOM | Anchor::TOP) as well. Presumably that should work without an protocol error (and certainly not a compositor crash).