Closed RealKC closed 2 years ago
As far as I know, format
is always supposed to be either 8, 16 or 32. But I don't think I encountered zero length props already.
What is the value of format
when length is not zero for the same property? Is it 32?
I can easily fix this by checking the length before the assertion.
What is the value of format when length is not zero for the same property? Is it 32?
Yeah it's always either 32(when length is nonzero) or 0(when length is zero) from my testing
It should be OK now. Don't hesitate to ask to reopen if not.
I just made the test program use xcb from git and it works! Thanks a lot :)
Here is a reproducer: https://gist.github.com/RealKC/3f472c7baa19ba27c88af27e0abcc494. If you uncomment the innermost
if
, the program will happily print the atoms for the windows which have _NET_WM_STATE set on them, if you keep it commented, the program will eventually maybe crash with the following assertion only if the WM returns properties with length 0 and format 0 on them:Note that this isn't reproducible everywhere, this happens for me on awesomewm but not to a friend who uses KDE.
Some possible fixes for the issue:
try_value
that instead of asserting returns an error?I'm not sure which of those is more elegant, but as an end-user I'd like to handle this case in some manner and I'm not sure checking the length would always work (I assume yes, since if the WM is sending 0 for format, you can't really use the reply anyway) and I don't exactly believe this is going against the EWMH spec? Some properties have
type/format
next to their name(at least that's how I interpret it, maybe I missed something in the spec), like_NET_WM_WINDOW_TYPE
(https://specifications.freedesktop.org/wm-spec/latest/ar01s05.html#idm46476783509232) which hasATOM[]/32
but_NET_WM_STATE
only hasATOM[]
see https://specifications.freedesktop.org/wm-spec/latest/ar01s05.html#idm46476783496896