2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 23:55:12 +00:00

Fix crash on quit in idle state.

This commit is contained in:
John Preston
2021-05-18 14:16:04 +04:00
parent 9144f4ea7b
commit f7454a4284
3 changed files with 18 additions and 7 deletions

View File

@@ -867,7 +867,11 @@ void Updates::updateOnline() {
}
bool Updates::isIdle() const {
return _isIdle;
return _isIdle.current();
}
rpl::producer<bool> Updates::isIdleValue() const {
return _isIdle.value();
}
void Updates::updateOnline(bool gotOtherOffline) {
@@ -881,7 +885,7 @@ void Updates::updateOnline(bool gotOtherOffline) {
const auto idle = crl::now() - Core::App().lastNonIdleTime();
if (idle >= config.offlineIdleTimeout) {
isOnline = false;
if (!_isIdle) {
if (!isIdle()) {
_isIdle = true;
_idleFinishTimer.callOnce(900);
}
@@ -932,10 +936,9 @@ void Updates::updateOnline(bool gotOtherOffline) {
void Updates::checkIdleFinish() {
if (crl::now() - Core::App().lastNonIdleTime()
< _session->serverConfig().offlineIdleTimeout) {
updateOnline();
_idleFinishTimer.cancel();
_isIdle = false;
updateOnline();
App::wnd()->checkHistoryActivation();
} else {
_idleFinishTimer.callOnce(900);
}