Fix crash in passcode setup.
This commit is contained in:
		
							parent
							
								
									c27456277e
								
							
						
					
					
						commit
						f4544b0964
					
				
					 3 changed files with 16 additions and 2 deletions
				
			
		|  | @ -476,9 +476,17 @@ void AuthSession::saveSettingsDelayed(crl::time delay) { | |||
| 	_saveDataTimer.callOnce(delay); | ||||
| } | ||||
| 
 | ||||
| void AuthSession::localPasscodeChanged() { | ||||
| 	_shouldLockAt = 0; | ||||
| 	_autoLockTimer.cancel(); | ||||
| 	checkAutoLock(); | ||||
| } | ||||
| 
 | ||||
| void AuthSession::checkAutoLock() { | ||||
| 	if (!Global::LocalPasscode() | ||||
| 		|| Core::App().passcodeLocked()) { | ||||
| 		_shouldLockAt = 0; | ||||
| 		_autoLockTimer.cancel(); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -487,6 +495,8 @@ void AuthSession::checkAutoLock() { | |||
| 	const auto shouldLockInMs = Global::AutoLock() * 1000LL; | ||||
| 	const auto checkTimeMs = now - Core::App().lastNonIdleTime(); | ||||
| 	if (checkTimeMs >= shouldLockInMs || (_shouldLockAt > 0 && now > _shouldLockAt + kAutoLockTimeoutLateMs)) { | ||||
| 		_shouldLockAt = 0; | ||||
| 		_autoLockTimer.cancel(); | ||||
| 		Core::App().lockByPasscode(); | ||||
| 	} else { | ||||
| 		_shouldLockAt = now + (shouldLockInMs - checkTimeMs); | ||||
|  |  | |||
|  | @ -316,6 +316,7 @@ public: | |||
| 
 | ||||
| 	void checkAutoLock(); | ||||
| 	void checkAutoLockIn(crl::time time); | ||||
| 	void localPasscodeChanged(); | ||||
| 
 | ||||
| 	rpl::lifetime &lifetime() { | ||||
| 		return _lifetime; | ||||
|  |  | |||
|  | @ -452,11 +452,14 @@ void PasscodeBox::save(bool force) { | |||
| 			changeCloudPassword(old, pwd); | ||||
| 		} | ||||
| 	} else { | ||||
| 		const auto weak = make_weak(this); | ||||
| 		cSetPasscodeBadTries(0); | ||||
| 		Local::setPasscode(pwd.toUtf8()); | ||||
| 		Auth().checkAutoLock(); | ||||
| 		Auth().localPasscodeChanged(); | ||||
| 		if (weak) { | ||||
| 			closeBox(); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| void PasscodeBox::clearCloudPassword(const QString &oldPassword) { | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 John Preston
						John Preston