diff options
-rw-r--r-- | src/managers/SessionLockManager.cpp | 1 | ||||
-rw-r--r-- | src/protocols/SessionLock.cpp | 12 | ||||
-rw-r--r-- | src/protocols/SessionLock.hpp | 1 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index 6dd096bb..fd4841f4 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -43,6 +43,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) { if (PROTO::sessionLock->isLocked() && !*PALLOWRELOCK) { Debug::log(LOG, "Cannot re-lock, misc:allow_session_lock_restore is disabled"); + pLock->sendDenied(); return; } diff --git a/src/protocols/SessionLock.cpp b/src/protocols/SessionLock.cpp index 19582be4..db3404be 100644 --- a/src/protocols/SessionLock.cpp +++ b/src/protocols/SessionLock.cpp @@ -113,6 +113,11 @@ CSessionLock::CSessionLock(SP<CExtSessionLockV1> resource_) : resource(resource_ }); resource->setUnlockAndDestroy([this](CExtSessionLockV1* r) { + if (inert) { + PROTO::sessionLock->destroyResource(this); + return; + } + events.unlockAndDestroy.emit(); inert = true; PROTO::sessionLock->locked = false; @@ -132,6 +137,11 @@ bool CSessionLock::good() { return resource->resource(); } +void CSessionLock::sendDenied() { + inert = true; + resource->sendFinished(); +} + CSessionLockProtocol::CSessionLockProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { ; } @@ -171,8 +181,8 @@ void CSessionLockProtocol::onLock(CExtSessionLockManagerV1* pMgr, uint32_t id) { if (m_vLocks.size() > 1) { LOGM(ERR, "Tried to lock a locked session"); - RESOURCE->resource->sendFinished(); RESOURCE->inert = true; + RESOURCE->resource->sendFinished(); return; } diff --git a/src/protocols/SessionLock.hpp b/src/protocols/SessionLock.hpp index b5d7aed5..6b0c4e08 100644 --- a/src/protocols/SessionLock.hpp +++ b/src/protocols/SessionLock.hpp @@ -52,6 +52,7 @@ class CSessionLock { bool good(); void sendLocked(); + void sendDenied(); struct { CSignal newLockSurface; // SP<CSessionLockSurface> |