Use send_closure instead of raw call.

This commit is contained in:
levlam 2021-10-06 23:33:18 +03:00
parent e18901953a
commit 4b41d620c5
2 changed files with 12 additions and 7 deletions

View File

@ -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<DialogAdministrator> administrators, Result<> result,
Promise<Unit> promise) {
if (result.is_ok()) {
if (!G()->close_flag() && result.is_ok()) {
dialog_administrators_.emplace(dialog_id, std::move(administrators));
}
promise.set_value(Unit());

View File

@ -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<Unit> result) {
load_data_multipromise_ptr->add_promise(PromiseCreator::lambda(
[actor_id = actor_id(this), sticker_file_id, short_name = set->short_name_](Result<Unit> 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()) {