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.
This commit is contained in:
outfoxxed 2024-06-19 11:16:51 -07:00
parent 59cf60d83e
commit 72956185bd
Signed by: outfoxxed
GPG Key ID: 4C88A185FB89301E
1 changed files with 5 additions and 1 deletions

View File

@ -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();