forked from quickshell/quickshell
feat(slock): intentionally protocol error if lock is destroyed
This commit is contained in:
parent
a255889e5c
commit
cdd5729642
|
@ -13,7 +13,12 @@ QSWaylandSessionLock::QSWaylandSessionLock(
|
||||||
this->init(lock); // if isInitialized is false that means we already unlocked.
|
this->init(lock); // if isInitialized is false that means we already unlocked.
|
||||||
}
|
}
|
||||||
|
|
||||||
QSWaylandSessionLock::~QSWaylandSessionLock() { this->unlock(); }
|
QSWaylandSessionLock::~QSWaylandSessionLock() {
|
||||||
|
if (this->isInitialized()) {
|
||||||
|
// This will intentionally lock the session if the lock is destroyed without calling unlock.
|
||||||
|
this->destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QSWaylandSessionLock::unlock() {
|
void QSWaylandSessionLock::unlock() {
|
||||||
if (this->isInitialized()) {
|
if (this->isInitialized()) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ bool SessionLockManager::lock() {
|
||||||
|
|
||||||
bool SessionLockManager::unlock() {
|
bool SessionLockManager::unlock() {
|
||||||
if (!this->isLocked()) return false;
|
if (!this->isLocked()) return false;
|
||||||
|
this->mLock->unlock();
|
||||||
auto* lock = this->mLock;
|
auto* lock = this->mLock;
|
||||||
this->mLock = nullptr;
|
this->mLock = nullptr;
|
||||||
delete lock;
|
delete lock;
|
||||||
|
|
Loading…
Reference in a new issue