From 20c01d91d4d04767ab6ea997a23cfa65fe043cf6 Mon Sep 17 00:00:00 2001 From: Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> Date: Fri, 19 Jul 2024 17:26:38 +0200 Subject: [PATCH] core: make sure m_sLockState.lock is present in onLockFinished and releaseSessionLock (#432) --- src/core/hyprlock.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 56a6248..2dc881c 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -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.