From a0d15a0b7b066cbb1b08ac54cf882c2c55467e4a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 25 Jul 2024 14:12:08 +0200 Subject: [PATCH] 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 --- src/protocols/core/Compositor.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp index f1c835311..a31b1fb4f 100644 --- a/src/protocols/core/Compositor.cpp +++ b/src/protocols/core/Compositor.cpp @@ -336,6 +336,17 @@ void CWLSurfaceResource::unmap() { mapped = false; 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) {