mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-21 00:23:56 +08:00
Guard delayed updateOnline on the window
Task: 2026/08/15/survive-last-primary-close-after-an-extra-window
This commit is contained in:
@@ -159,20 +159,6 @@ void Controller::showAccount(
|
||||
_id.account = account;
|
||||
Core::App().checkWindowId(this);
|
||||
|
||||
const auto updateOnlineOfPrevSesssion = crl::guard(account, [=] {
|
||||
if (!prevSessionUniqueId) {
|
||||
return;
|
||||
}
|
||||
for (auto &[index, account] : _id.account->domain().accounts()) {
|
||||
if (const auto anotherSession = account->maybeSession()) {
|
||||
if (anotherSession->uniqueId() == prevSessionUniqueId) {
|
||||
anotherSession->updates().updateOnline(crl::now());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!isPrimary()) {
|
||||
_id.account->sessionChanges(
|
||||
) | rpl::on_next([=](Main::Session *session) {
|
||||
@@ -227,7 +213,19 @@ void Controller::showAccount(
|
||||
_widget.updateGlobalMenu();
|
||||
}
|
||||
|
||||
crl::on_main(updateOnlineOfPrevSesssion);
|
||||
crl::on_main(this, [=] {
|
||||
if (!prevSessionUniqueId) {
|
||||
return;
|
||||
}
|
||||
for (auto &[index, account] : _id.account->domain().accounts()) {
|
||||
if (const auto anotherSession = account->maybeSession()) {
|
||||
if (anotherSession->uniqueId() == prevSessionUniqueId) {
|
||||
anotherSession->updates().updateOnline(crl::now());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}, _accountLifetime);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user