aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTom Englund <[email protected]>2024-08-01 11:42:22 +0200
committerGitHub <[email protected]>2024-08-01 11:42:22 +0200
commit5b7057c4790e0dafea53c2343a792c17e2dbf4a7 (patch)
treef3e2a0c4dd604b991b258cdc754d277bd6828f0a
parent37e1411e8d94fe8f3fb678588a7df9b8f931910f (diff)
downloadHyprland-5b7057c4790e0dafea53c2343a792c17e2dbf4a7.tar.gz
Hyprland-5b7057c4790e0dafea53c2343a792c17e2dbf4a7.zip
pointer: fix buffer crash (#7131)
current buffer->buffer can turn out to be null actually check for its existence or use the lastbuffer when calling updateCursorShm()
-rw-r--r--src/protocols/core/Compositor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp
index 81be8e46..bff52133 100644
--- a/src/protocols/core/Compositor.cpp
+++ b/src/protocols/core/Compositor.cpp
@@ -480,14 +480,14 @@ void CWLSurfaceResource::commitPendingState() {
}
void CWLSurfaceResource::updateCursorShm() {
- auto buf = current.buffer ? current.buffer : lastBuffer;
+ auto buf = current.buffer ? current.buffer->buffer : lastBuffer;
if (!buf)
return;
// TODO: actually use damage
auto& shmData = CCursorSurfaceRole::cursorPixelData(self.lock());
- auto shmAttrs = current.buffer->buffer->shm();
+ auto shmAttrs = buf->shm();
if (!shmAttrs.success) {
LOGM(TRACE, "updateCursorShm: ignoring, not a shm buffer");
@@ -495,7 +495,7 @@ void CWLSurfaceResource::updateCursorShm() {
}
// no need to end, shm.
- auto [pixelData, fmt, bufLen] = current.buffer->buffer->beginDataPtr(0);
+ auto [pixelData, fmt, bufLen] = buf->beginDataPtr(0);
shmData.resize(bufLen);
memcpy(shmData.data(), pixelData, bufLen);