From 31d1326fc404e1cd56cfa84c7b7907d0799fa602 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 15 Jul 2026 19:08:28 +0400 Subject: [PATCH] Fix possible crash in notifications hiding. --- .../SourceFiles/window/notifications_manager_default.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 1cc4d549f0..0c170d87ee 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -1193,8 +1193,17 @@ bool Notification::unlinkHistory( bool Notification::unlinkSession(not_null session) { const auto unlink = _history && (&_history->session() == session); if (unlink) { + // Custom emoji in title and text caches are owned by the session, + // while the widget outlives it for the hide animation, so caches + // must be destroyed right here. The already rendered _cache image + // is still painted, so don't re-render it from the empty strings. + _titleCache = Ui::Text::String(); + _textCache = Ui::Text::String(); + _textsRepaintScheduled = false; hideFast(); _history = nullptr; + _topic = nullptr; + _sublist = nullptr; _item = nullptr; } return unlink;