From 4b41d620c5884f6ee0e1872a6f0745dab146d578 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 6 Oct 2021 23:33:18 +0300 Subject: [PATCH] Use send_closure instead of raw call. --- td/telegram/ContactsManager.cpp | 8 ++++---- td/telegram/StickersManager.cpp | 11 ++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index a2762a4b9..fe83e0c3e 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -15204,9 +15204,9 @@ void ContactsManager::on_load_dialog_administrators_from_database(DialogId dialo << " from database"; MultiPromiseActorSafe load_users_multipromise{"LoadUsersMultiPromiseActor"}; - load_users_multipromise.add_promise( - PromiseCreator::lambda([dialog_id, administrators, promise = std::move(promise)](Result<> result) mutable { - send_closure(G()->contacts_manager(), &ContactsManager::on_load_administrator_users_finished, dialog_id, + load_users_multipromise.add_promise(PromiseCreator::lambda( + [actor_id = actor_id(this), dialog_id, administrators, promise = std::move(promise)](Result<> result) mutable { + send_closure(actor_id, &ContactsManager::on_load_administrator_users_finished, dialog_id, std::move(administrators), std::move(result), std::move(promise)); })); @@ -15222,7 +15222,7 @@ void ContactsManager::on_load_dialog_administrators_from_database(DialogId dialo void ContactsManager::on_load_administrator_users_finished(DialogId dialog_id, vector administrators, Result<> result, Promise promise) { - if (result.is_ok()) { + if (!G()->close_flag() && result.is_ok()) { dialog_administrators_.emplace(dialog_id, std::move(administrators)); } promise.set_value(Unit()); diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 95699f526..4e669bedd 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -2293,11 +2293,12 @@ StickerSetId StickersManager::on_get_input_sticker_set(FileId sticker_file_id, } auto set_id = search_sticker_set(set->short_name_, load_data_multipromise_ptr->get_promise()); if (!set_id.is_valid()) { - load_data_multipromise_ptr->add_promise( - PromiseCreator::lambda([td = td_, sticker_file_id, short_name = set->short_name_](Result result) { + load_data_multipromise_ptr->add_promise(PromiseCreator::lambda( + [actor_id = actor_id(this), sticker_file_id, short_name = set->short_name_](Result result) { if (result.is_ok()) { // just in case - td->stickers_manager_->on_resolve_sticker_set_short_name(sticker_file_id, short_name); + send_closure(actor_id, &StickersManager::on_resolve_sticker_set_short_name, sticker_file_id, + short_name); } })); } @@ -2317,6 +2318,10 @@ StickerSetId StickersManager::on_get_input_sticker_set(FileId sticker_file_id, } void StickersManager::on_resolve_sticker_set_short_name(FileId sticker_file_id, const string &short_name) { + if (G()->close_flag()) { + return; + } + LOG(INFO) << "Resolve sticker " << sticker_file_id << " set to " << short_name; StickerSetId set_id = search_sticker_set(short_name, Auto()); if (set_id.is_valid()) {