session-lock: don't allow events from rejected locks

fixes #5913
This commit is contained in:
Vaxry 2024-05-07 18:42:55 +01:00
parent 598bbd186b
commit 22a86fd7a2
3 changed files with 13 additions and 1 deletions

View file

@ -43,6 +43,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
if (PROTO::sessionLock->isLocked() && !*PALLOWRELOCK) { if (PROTO::sessionLock->isLocked() && !*PALLOWRELOCK) {
Debug::log(LOG, "Cannot re-lock, misc:allow_session_lock_restore is disabled"); Debug::log(LOG, "Cannot re-lock, misc:allow_session_lock_restore is disabled");
pLock->sendDenied();
return; return;
} }

View file

@ -113,6 +113,11 @@ CSessionLock::CSessionLock(SP<CExtSessionLockV1> resource_) : resource(resource_
}); });
resource->setUnlockAndDestroy([this](CExtSessionLockV1* r) { resource->setUnlockAndDestroy([this](CExtSessionLockV1* r) {
if (inert) {
PROTO::sessionLock->destroyResource(this);
return;
}
events.unlockAndDestroy.emit(); events.unlockAndDestroy.emit();
inert = true; inert = true;
PROTO::sessionLock->locked = false; PROTO::sessionLock->locked = false;
@ -132,6 +137,11 @@ bool CSessionLock::good() {
return resource->resource(); 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) { 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) { if (m_vLocks.size() > 1) {
LOGM(ERR, "Tried to lock a locked session"); LOGM(ERR, "Tried to lock a locked session");
RESOURCE->resource->sendFinished();
RESOURCE->inert = true; RESOURCE->inert = true;
RESOURCE->resource->sendFinished();
return; return;
} }

View file

@ -52,6 +52,7 @@ class CSessionLock {
bool good(); bool good();
void sendLocked(); void sendLocked();
void sendDenied();
struct { struct {
CSignal newLockSurface; // SP<CSessionLockSurface> CSignal newLockSurface; // SP<CSessionLockSurface>