From c40ab5d8d60bacf04521382908d82de4996683d9 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 27 Feb 2018 04:14:47 +0300 Subject: [PATCH] Fix loading of sticker sets. GitOrigin-RevId: dc3d4425181d154a0aa5dbc2b7e1042ef216a127 --- td/telegram/StickersManager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 9bd26135..90b23932 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -2034,6 +2034,7 @@ void StickersManager::on_load_installed_sticker_sets_from_database(bool is_masks sets_to_load.push_back(sticker_set_id); } } + std::reverse(sets_to_load.begin(), sets_to_load.end()); // load installed sticker sets in reverse order load_sticker_sets_without_stickers( std::move(sets_to_load), @@ -2049,8 +2050,9 @@ void StickersManager::on_load_installed_sticker_sets_from_database(bool is_masks void StickersManager::on_load_installed_sticker_sets_finished(bool is_masks, vector &&installed_sticker_set_ids, bool from_database) { bool need_reload = false; + vector old_installed_sticker_set_ids; if (!are_installed_sticker_sets_loaded_[is_masks] && !installed_sticker_set_ids_[is_masks].empty()) { - need_reload = true; + old_installed_sticker_set_ids = std::move(installed_sticker_set_ids_[is_masks]); } installed_sticker_set_ids_[is_masks].clear(); for (auto set_id : installed_sticker_set_ids) { @@ -2070,6 +2072,11 @@ void StickersManager::on_load_installed_sticker_sets_finished(bool is_masks, vec LOG(ERROR) << "Reload installed sticker sets, because only " << installed_sticker_set_ids_[is_masks].size() << " of " << installed_sticker_set_ids.size() << " are really installed"; reload_installed_sticker_sets(is_masks, true); + } else if (!old_installed_sticker_set_ids.empty() && + old_installed_sticker_set_ids != installed_sticker_set_ids_[is_masks]) { + LOG(ERROR) << "Reload installed sticker sets, because they has changed from " << old_installed_sticker_set_ids + << " to " << installed_sticker_set_ids_[is_masks]; + reload_installed_sticker_sets(is_masks, true); } are_installed_sticker_sets_loaded_[is_masks] = true;