core: make sure m_sLockState.lock is present in onLockFinished and releaseSessionLock (#432)

This commit is contained in:
Maximilian Seidler 2024-07-19 17:26:38 +02:00 committed by GitHub
parent 372a4cd55e
commit 20c01d91d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -941,11 +941,16 @@ void CHyprlock::acquireSessionLock() {
void CHyprlock::releaseSessionLock() {
Debug::log(LOG, "Unlocking session");
if (m_bTerminate && !m_sLockState.lock) {
if (m_bTerminate) {
Debug::log(ERR, "Unlock already happend?");
return;
}
if (!m_sLockState.lock) {
Debug::log(ERR, "Unlock without a lock object!");
return;
}
if (!m_bLocked) {
// Would be a protocol error to allow this
Debug::log(ERR, "Trying to unlock the session, but never recieved the locked event!");
@ -977,6 +982,12 @@ void CHyprlock::onLockLocked() {
void CHyprlock::onLockFinished() {
Debug::log(LOG, "onLockFinished called. Seems we got yeeten. Is another lockscreen running?");
if (!m_sLockState.lock) {
Debug::log(ERR, "onLockFinished without a lock object!");
return;
}
if (m_bLocked)
// The `finished` event specifies that whenever the `locked` event has been recieved and the compositor sends `finished`,
// `unlock_and_destroy` should be called by the client.