summaryrefslogtreecommitdiff
path: root/src/protocols/core/Compositor.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-07-29 19:02:58 +0200
committerVaxry <vaxry@vaxry.net>2024-07-29 19:29:08 +0200
commite67322034037fef22079c8e480be38c1d04b5a4a (patch)
tree40778b615ecb56680825ba3e268081dae4e3f854 /src/protocols/core/Compositor.cpp
parent9c38b0fdbe32dc2cb81d53c9be90113d114f1cd2 (diff)
core/surface: fixup a few pointer handling edge cases
Diffstat (limited to 'src/protocols/core/Compositor.cpp')
-rw-r--r--src/protocols/core/Compositor.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp
index 6352b7e6..43d3059b 100644
--- a/src/protocols/core/Compositor.cpp
+++ b/src/protocols/core/Compositor.cpp
@@ -156,6 +156,7 @@ void CWLSurfaceResource::destroy() {
unmap();
}
events.destroy.emit();
+ releaseBuffers(false);
PROTO::compositor->destroyResource(this);
}
@@ -338,13 +339,18 @@ void CWLSurfaceResource::unmap() {
// 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.
+ releaseBuffers();
+}
+
+void CWLSurfaceResource::releaseBuffers(bool onlyCurrent) {
if (current.buffer && !current.buffer->resource->released)
current.buffer->sendRelease();
- if (pending.buffer && !pending.buffer->resource->released)
+ if (pending.buffer && !pending.buffer->resource->released && !onlyCurrent)
pending.buffer->sendRelease();
pending.buffer.reset();
- current.buffer.reset();
+ if (!onlyCurrent)
+ current.buffer.reset();
}
void CWLSurfaceResource::error(int code, const std::string& str) {