mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Alpha 1.0.20: fix crash in default notifications.
Before showNextFromQueue() was called from a range-for loop over the _notifications and it invalidated the _notifications iterators.
This commit is contained in:
@@ -321,9 +321,15 @@ void Manager::doClearFromItem(HistoryItem *item) {
|
||||
return (queued.item == item);
|
||||
}), _queuedNotifications.cend());
|
||||
|
||||
auto showNext = false;
|
||||
for_const (auto ¬ification, _notifications) {
|
||||
// Calls unlinkFromShown() -> showNextFromQueue()
|
||||
notification->itemRemoved(item);
|
||||
if (notification->unlinkItem(item)) {
|
||||
showNext = true;
|
||||
}
|
||||
}
|
||||
if (showNext) {
|
||||
// This call invalidates _notifications iterators.
|
||||
showNextFromQueue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,11 +696,13 @@ void Notification::updatePeerPhoto() {
|
||||
update();
|
||||
}
|
||||
|
||||
void Notification::itemRemoved(HistoryItem *deleted) {
|
||||
if (_item && _item == deleted) {
|
||||
bool Notification::unlinkItem(HistoryItem *deleted) {
|
||||
auto unlink = (_item && _item == deleted);
|
||||
if (unlink) {
|
||||
_item = nullptr;
|
||||
unlinkHistoryInManager();
|
||||
unlinkHistory();
|
||||
}
|
||||
return unlink;
|
||||
}
|
||||
|
||||
bool Notification::canReply() const {
|
||||
|
Reference in New Issue
Block a user