mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-03 16:05:57 +00:00
Destroy non-authed account on deactivate.
This commit is contained in:
@@ -341,10 +341,12 @@ void Domain::activate(not_null<Main::Account*> account) {
|
|||||||
});
|
});
|
||||||
Assert(i != end(_accounts));
|
Assert(i != end(_accounts));
|
||||||
const auto changed = (_accountToActivate != i->index);
|
const auto changed = (_accountToActivate != i->index);
|
||||||
|
auto wasAuthed = false;
|
||||||
|
|
||||||
_activeLifetime.destroy();
|
_activeLifetime.destroy();
|
||||||
if (_active.current()) {
|
if (_active.current()) {
|
||||||
_lastActiveIndex = _accountToActivate;
|
_lastActiveIndex = _accountToActivate;
|
||||||
|
wasAuthed = _active.current()->sessionExists();
|
||||||
}
|
}
|
||||||
_accountToActivate = i->index;
|
_accountToActivate = i->index;
|
||||||
_active = account.get();
|
_active = account.get();
|
||||||
@@ -352,7 +354,13 @@ void Domain::activate(not_null<Main::Account*> account) {
|
|||||||
) | rpl::start_to_stream(_activeSessions, _activeLifetime);
|
) | rpl::start_to_stream(_activeSessions, _activeLifetime);
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
if (wasAuthed) {
|
||||||
scheduleWriteAccounts();
|
scheduleWriteAccounts();
|
||||||
|
} else {
|
||||||
|
crl::on_main(&Core::App(), [=] {
|
||||||
|
removeRedundantAccounts();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user