From fdb7ca6c8fa3611ab04eccf129a515efd9852c73 Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Sat, 22 Mar 2025 17:06:02 -0500 Subject: [PATCH] core/compositor: Fix dropping cursor buffer data early (#9700) --- src/protocols/core/Compositor.cpp | 4 +++- src/protocols/core/Seat.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp index 5462fbe94..2dd374a8a 100644 --- a/src/protocols/core/Compositor.cpp +++ b/src/protocols/core/Compositor.cpp @@ -12,6 +12,7 @@ #include "../DRMSyncobj.hpp" #include "../../render/Renderer.hpp" #include "config/ConfigValue.hpp" +#include "protocols/types/SurfaceRole.hpp" #include "render/Texture.hpp" #include @@ -445,7 +446,8 @@ void CWLSurfaceResource::commitPendingState(SSurfaceState& state) { // release the buffer if it's synchronous (SHM) as update() has done everything thats needed // so we can let the app know we're done. - if (current.buffer && current.buffer->buffer && current.buffer->buffer->isSynchronous()) + // if it doesn't have a role, we can't release it yet, in case it gets turned into a cursor. + if (current.buffer && current.buffer->buffer && current.buffer->buffer->isSynchronous() && role->role() != SURFACE_ROLE_UNASSIGNED) dropCurrentBuffer(); } diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp index 1f07a15e0..5bdb95f0e 100644 --- a/src/protocols/core/Seat.cpp +++ b/src/protocols/core/Seat.cpp @@ -124,7 +124,7 @@ CWLPointerResource::CWLPointerResource(SP resource_, SProle->role() != SURFACE_ROLE_CURSOR) { surfResource->role = makeShared(); surfResource->updateCursorShm(); }