From 1395237810e3cf330f36a7ed335edcb528e38cb6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 12 Mar 2017 11:49:44 +0300 Subject: [PATCH] Fix crash in notifications. ~HistoryItem() sometimes causes a queued notification to show. Custom notifications depend on MainWindow and it is destroyed already in clearHistories(), so clear the notifications queue first. --- Telegram/SourceFiles/app.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 1c8144695..21420aba9 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -2319,6 +2319,11 @@ namespace { ClickHandler::clearActive(); ClickHandler::unpressed(); + if (AuthSession::Exists()) { + // Clear notifications to prevent any showNotification() calls while destroying items. + AuthSession::Current().notifications()->clearAllFast(); + } + histories().clear(); clearStorageImages();