From 77078f704c9ca6c8fc16850f107ffb15196381c9 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 28 Dec 2022 12:44:01 +0400 Subject: [PATCH] Fix a crash in topic deletion. --- .../SourceFiles/window/window_session_controller.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 7f82d249f..4233de048 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -1749,7 +1749,15 @@ void SessionController::showSection( } void SessionController::showBackFromStack(const SectionShow ¶ms) { - content()->showBackFromStack(params); + const auto bad = [&] { + // If we show a currently-being-destroyed topic, then + // skip it and show back one more. + const auto topic = _activeChatEntry.current().key.topic(); + return topic && topic->forum()->topicDeleted(topic->rootId()); + }; + do { + content()->showBackFromStack(params); + } while (bad()); } void SessionController::showSpecialLayer(