2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Version 2.4: Fix crash in typing animations.

This commit is contained in:
John Preston
2020-09-30 21:05:19 +03:00
parent 4e366dc86e
commit 11e03a181d
3 changed files with 25 additions and 2 deletions

View File

@@ -880,7 +880,20 @@ HistoryView::SendActionPainter *Session::lookupSendActionPainter(
return nullptr;
}
const auto j = i->second.find(rootId);
return (j == end(i->second)) ? nullptr : j->second.lock().get();
if (j == end(i->second)) {
return nullptr;
}
const auto result = j->second.lock();
if (!result) {
i->second.erase(j);
if (i->second.empty()) {
_sendActionPainters.erase(i);
}
return nullptr;
}
crl::on_main([copy = result] {
});
return result.get();
}
void Session::registerSendAction(
@@ -959,7 +972,7 @@ bool Session::sendActionsAnimationCallback(crl::time now) {
const auto sendAction = lookupSendActionPainter(
i->first.first,
i->first.second);
if (sendAction->updateNeedsAnimating(now)) {
if (sendAction && sendAction->updateNeedsAnimating(now)) {
++i;
} else {
i = _sendActions.erase(i);