From d5de06401953cfae8fa4d4788512bf49acecd011 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 18 Dec 2017 15:17:58 +0400 Subject: [PATCH] Shuffle code around a bit. Crash reports point to addToUnreadMentions() call being corrupted. New reports could show is it responsible or setLastMessage() call. --- Telegram/SourceFiles/history/history.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 56494bc4d..8527b05bf 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -1274,13 +1274,8 @@ not_null History::addNewItem(not_null adding, bool n recountGrouping(groupFrom, groupTill); } - setLastMessage(adding); - if (newMsg) { - newItemAdded(adding); - } - - adding->addToUnreadMentions(AddToUnreadMentionsMethod::New); if (IsServerMsgId(adding->id)) { + adding->addToUnreadMentions(AddToUnreadMentionsMethod::New); if (auto sharedMediaTypes = adding->sharedMediaTypes()) { if (newMsg) { Auth().storage().add(Storage::SharedMediaAddNew( @@ -1378,6 +1373,11 @@ not_null History::addNewItem(not_null adding, bool n } } + setLastMessage(adding); + if (newMsg) { + newItemAdded(adding); + } + return adding; }