core: fix second instance of hyprlock unlocking session (#376)

* fix second instance of hyprlock unlocking session

* fix segfault when lock cannot be acquired

* improve ordering of display roundtrips
This commit is contained in:
Florian Walter 2024-06-25 13:46:58 +02:00 committed by GitHub
parent c5b8ad03d0
commit 210b456c15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -926,6 +926,9 @@ void CHyprlock::acquireSessionLock() {
Debug::log(LOG, "Locking session"); Debug::log(LOG, "Locking session");
m_sLockState.lock = ext_session_lock_manager_v1_lock(m_sWaylandState.sessionLock); m_sLockState.lock = ext_session_lock_manager_v1_lock(m_sWaylandState.sessionLock);
ext_session_lock_v1_add_listener(m_sLockState.lock, &sessionLockListener, nullptr); ext_session_lock_v1_add_listener(m_sLockState.lock, &sessionLockListener, nullptr);
// wait for wayland to signal whether the session lock has been acquired
wl_display_roundtrip(m_sWaylandState.display);
} }
void CHyprlock::releaseSessionLock() { void CHyprlock::releaseSessionLock() {
@ -958,8 +961,8 @@ void CHyprlock::onLockLocked() {
void CHyprlock::onLockFinished() { void CHyprlock::onLockFinished() {
Debug::log(LOG, "onLockFinished called. Seems we got yeeten. Is another lockscreen running?"); Debug::log(LOG, "onLockFinished called. Seems we got yeeten. Is another lockscreen running?");
ext_session_lock_v1_unlock_and_destroy(m_sLockState.lock); g_pRenderer = nullptr;
m_sLockState.lock = nullptr; exit(1);
} }
ext_session_lock_manager_v1* CHyprlock::getSessionLockMgr() { ext_session_lock_manager_v1* CHyprlock::getSessionLockMgr() {