mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Fix crash in history clear while sending messages.
Don't remove messages that are currently being sent from locals.
This commit is contained in:
parent
7893ad0558
commit
ee0f66d746
1 changed files with 9 additions and 1 deletions
|
@ -3060,8 +3060,16 @@ void History::clear(ClearType type) {
|
||||||
lastKeyboardInited = false;
|
lastKeyboardInited = false;
|
||||||
_loadedAtTop = _loadedAtBottom = false;
|
_loadedAtTop = _loadedAtBottom = false;
|
||||||
} else {
|
} else {
|
||||||
|
// Leave the 'sending' messages in local messages.
|
||||||
|
for (auto i = begin(_localMessages); i != end(_localMessages);) {
|
||||||
|
const auto item = *i;
|
||||||
|
if (!item->isSending()) {
|
||||||
|
i = _localMessages.erase(i);
|
||||||
|
} else {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
_notifications.clear();
|
_notifications.clear();
|
||||||
_localMessages.clear();
|
|
||||||
owner().notifyHistoryCleared(this);
|
owner().notifyHistoryCleared(this);
|
||||||
if (unreadCountKnown()) {
|
if (unreadCountKnown()) {
|
||||||
setUnreadCount(0);
|
setUnreadCount(0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue