Fix crash clearing chats list before histories.

This commit is contained in:
John Preston 2023-02-12 14:39:06 +04:00
parent 13a9920c11
commit d0c2bec925
4 changed files with 9 additions and 0 deletions

View file

@ -381,6 +381,9 @@ void Session::clear() {
cSetRecentInlineBots(RecentInlineBots()); cSetRecentInlineBots(RecentInlineBots());
cSetRecentStickers(RecentStickerPack()); cSetRecentStickers(RecentStickerPack());
HistoryView::Element::ClearGlobal(); HistoryView::Element::ClearGlobal();
_contactsNoChatsList.clear();
_contactsList.clear();
_chatsList.clear();
_histories->clearAll(); _histories->clearAll();
_webpages.clear(); _webpages.clear();
_locations.clear(); _locations.clear();

View file

@ -205,6 +205,7 @@ void IndexedList::remove(Key key, Row *replacedBy) {
} }
void IndexedList::clear() { void IndexedList::clear() {
_list.clear();
_index.clear(); _index.clear();
} }

View file

@ -23,6 +23,10 @@ public:
List &operator=(List &&other) = default; List &operator=(List &&other) = default;
~List() = default; ~List() = default;
void clear() {
_rows.clear();
_rowByKey.clear();
}
[[nodiscard]] int size() const { [[nodiscard]] int size() const {
return _rows.size(); return _rows.size();
} }

View file

@ -81,6 +81,7 @@ void MainList::clear() {
recomputeFullListSize(); recomputeFullListSize();
}); });
const auto notifier = unreadStateChangeNotifier(true); const auto notifier = unreadStateChangeNotifier(true);
_pinned.clear();
_all.clear(); _all.clear();
_unreadState = UnreadState(); _unreadState = UnreadState();
_cloudUnreadState = UnreadState(); _cloudUnreadState = UnreadState();