Destroying a wl_buffer after attach/commit causes that buffer to not be displayed
According to the wl_surface.attach spec:
Destroying the wl_buffer after wl_buffer.release does not change the surface contents. Destroying the wl_buffer before wl_buffer.release is allowed as long as the underlying buffer storage isn't re-used (this can happen e.g. on client process termination). However, if the client destroys the wl_buffer before receiving the wl_buffer.release event and mutates the underlying buffer storage, the surface contents become undefined immediately.
My understanding of the above is that a client destroying a wl_buffer and releasing its backing storage (e.g., munmap-ing and closing an SHM fd backing a buffer) after an attach/commit, should not affect the presentation of that wl_buffer by the compositor.
However, Weston seems to "lose" the buffer contents in such a case. I have uploaded a simple Weston test showcasing the issue here:
https://gitlab.freedesktop.org/afrantzis/weston/-/commits/buffer-destroy-after-commit-test
(Removing the early buffer_destroy(buf)
in that test makes it pass)