From 72956185bd64cabb07af990419e23ae8b8c56f6e Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Wed, 19 Jun 2024 11:16:51 -0700 Subject: [PATCH] wayland/lock: only update surfaces on screens changed if locked Fixes crash when a WlSessionLock object exists but is unlocked and a screen is added or removed. --- src/wayland/session_lock.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wayland/session_lock.cpp b/src/wayland/session_lock.cpp index 251d7b8..5f0bb67 100644 --- a/src/wayland/session_lock.cpp +++ b/src/wayland/session_lock.cpp @@ -130,7 +130,11 @@ void WlSessionLock::unlock() { } } -void WlSessionLock::onScreensChanged() { this->updateSurfaces(true); } +void WlSessionLock::onScreensChanged() { + if (this->manager != nullptr && this->manager->isLocked()) { + this->updateSurfaces(true); + } +} bool WlSessionLock::isLocked() const { return this->manager == nullptr ? this->lockTarget : this->manager->isLocked();