mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 14:45:59 +01:00
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()
This commit is contained in:
parent
37e1411e8d
commit
5b7057c479
1 changed files with 3 additions and 3 deletions
|
@ -480,14 +480,14 @@ void CWLSurfaceResource::commitPendingState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWLSurfaceResource::updateCursorShm() {
|
void CWLSurfaceResource::updateCursorShm() {
|
||||||
auto buf = current.buffer ? current.buffer : lastBuffer;
|
auto buf = current.buffer ? current.buffer->buffer : lastBuffer;
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: actually use damage
|
// TODO: actually use damage
|
||||||
auto& shmData = CCursorSurfaceRole::cursorPixelData(self.lock());
|
auto& shmData = CCursorSurfaceRole::cursorPixelData(self.lock());
|
||||||
auto shmAttrs = current.buffer->buffer->shm();
|
auto shmAttrs = buf->shm();
|
||||||
|
|
||||||
if (!shmAttrs.success) {
|
if (!shmAttrs.success) {
|
||||||
LOGM(TRACE, "updateCursorShm: ignoring, not a shm buffer");
|
LOGM(TRACE, "updateCursorShm: ignoring, not a shm buffer");
|
||||||
|
@ -495,7 +495,7 @@ void CWLSurfaceResource::updateCursorShm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to end, shm.
|
// no need to end, shm.
|
||||||
auto [pixelData, fmt, bufLen] = current.buffer->buffer->beginDataPtr(0);
|
auto [pixelData, fmt, bufLen] = buf->beginDataPtr(0);
|
||||||
|
|
||||||
shmData.resize(bufLen);
|
shmData.resize(bufLen);
|
||||||
memcpy(shmData.data(), pixelData, bufLen);
|
memcpy(shmData.data(), pixelData, bufLen);
|
||||||
|
|
Loading…
Reference in a new issue