mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix crash in cloud lang manager destructor.
This commit is contained in:
parent
d0c2bec925
commit
1da635a5dd
3 changed files with 23 additions and 24 deletions
|
@ -148,18 +148,19 @@ auto ProcessAlternativeName(Info &&info) {
|
||||||
Manager::Manager(not_null<Main::Domain*> domain)
|
Manager::Manager(not_null<Main::Domain*> domain)
|
||||||
: _path(cWorkingDir() + "tdata/countries") {
|
: _path(cWorkingDir() + "tdata/countries") {
|
||||||
read();
|
read();
|
||||||
|
|
||||||
|
const auto mtpLifetime = _lifetime.make_state<rpl::lifetime>();
|
||||||
domain->activeValue(
|
domain->activeValue(
|
||||||
) | rpl::map([=](Main::Account *account) {
|
) | rpl::filter([=](Main::Account *account) {
|
||||||
if (!account) {
|
return (account != nullptr);
|
||||||
_api.reset();
|
}) | rpl::start_with_next_done([=](Main::Account *account) {
|
||||||
}
|
*mtpLifetime = account->mtpMainSessionValue(
|
||||||
return account
|
) | rpl::start_with_next([=](not_null<MTP::Instance*> instance) {
|
||||||
? account->mtpMainSessionValue()
|
_api.emplace(instance);
|
||||||
: rpl::never<not_null<MTP::Instance*>>();
|
request();
|
||||||
}) | rpl::flatten_latest(
|
});
|
||||||
) | rpl::start_with_next([=](not_null<MTP::Instance*> instance) {
|
}, [=] {
|
||||||
_api.emplace(instance);
|
_api.reset();
|
||||||
request();
|
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,18 +158,18 @@ Language ParseLanguage(const MTPLangPackLanguage &data) {
|
||||||
|
|
||||||
CloudManager::CloudManager(Instance &langpack)
|
CloudManager::CloudManager(Instance &langpack)
|
||||||
: _langpack(langpack) {
|
: _langpack(langpack) {
|
||||||
|
const auto mtpLifetime = _lifetime.make_state<rpl::lifetime>();
|
||||||
Core::App().domain().activeValue(
|
Core::App().domain().activeValue(
|
||||||
) | rpl::map([=](Main::Account *account) {
|
) | rpl::filter([=](Main::Account *account) {
|
||||||
if (!account) {
|
return (account != nullptr);
|
||||||
_api.reset();
|
}) | rpl::start_with_next_done([=](Main::Account *account) {
|
||||||
}
|
*mtpLifetime = account->mtpMainSessionValue(
|
||||||
return account
|
) | rpl::start_with_next([=](not_null<MTP::Instance*> instance) {
|
||||||
? account->mtpMainSessionValue()
|
_api.emplace(instance);
|
||||||
: rpl::never<not_null<MTP::Instance*>>();
|
resendRequests();
|
||||||
}) | rpl::flatten_latest(
|
});
|
||||||
) | rpl::start_with_next([=](not_null<MTP::Instance*> instance) {
|
}, [=] {
|
||||||
_api.emplace(instance);
|
_api.reset();
|
||||||
resendRequests();
|
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,8 +202,6 @@ Account &Domain::active() const {
|
||||||
return *_active.current();
|
return *_active.current();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rpl::producer<not_null<Account*>> Domain::activeChanges() const {
|
rpl::producer<not_null<Account*>> Domain::activeChanges() const {
|
||||||
return _active.changes() | rpl::map([](Account *value) {
|
return _active.changes() | rpl::map([](Account *value) {
|
||||||
return not_null{ value };
|
return not_null{ value };
|
||||||
|
|
Loading…
Add table
Reference in a new issue