forked from quickshell/quickshell
		
	feat(slock): intentionally protocol error if lock is destroyed
This commit is contained in:
		
							parent
							
								
									a255889e5c
								
							
						
					
					
						commit
						cdd5729642
					
				
					 2 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -13,7 +13,12 @@ QSWaylandSessionLock::QSWaylandSessionLock(
 | 
			
		|||
	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() {
 | 
			
		||||
	if (this->isInitialized()) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,7 @@ bool SessionLockManager::lock() {
 | 
			
		|||
 | 
			
		||||
bool SessionLockManager::unlock() {
 | 
			
		||||
	if (!this->isLocked()) return false;
 | 
			
		||||
	this->mLock->unlock();
 | 
			
		||||
	auto* lock = this->mLock;
 | 
			
		||||
	this->mLock = nullptr;
 | 
			
		||||
	delete lock;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue