wayland/compositor: release buffers on unmap

XWayland does not use the regular commit(null) method to unmap, which results in buffers never being released.

release the buffers if present and un-released in the unmap() handler

ref #6584
This commit is contained in:
Vaxry 2024-07-25 14:12:08 +02:00
parent cd942ad12d
commit a0d15a0b7b

View file

@ -336,6 +336,17 @@ void CWLSurfaceResource::unmap() {
mapped = false; mapped = false;
events.unmap.emit(); events.unmap.emit();
// release the buffers.
// this is necessary for XWayland to function correctly,
// as it does not unmap via the traditional commit(null buffer) method, but via the X11 protocol.
if (!bufferReleased && current.buffer)
current.buffer->sendRelease();
if (pending.buffer)
pending.buffer->sendRelease();
pending.buffer.reset();
current.buffer.reset();
} }
void CWLSurfaceResource::error(int code, const std::string& str) { void CWLSurfaceResource::error(int code, const std::string& str) {