From c43ce8b8dca67690cf100ef31495120ff01728c2 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 3 Jul 2026 14:09:50 +0400 Subject: [PATCH] Fix possible crash in Dialogs::Widget::~Widget. --- Telegram/SourceFiles/dialogs/dialogs_widget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 3a84b25efd..9c57c242c4 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -4783,6 +4783,14 @@ Widget::~Widget() { // Destructor may hide the bar and attempt to double-destroy it. base::take(_downloadBar); + + // Destroying a row of _innerList removes it from the layout, resizing + // the layout and firing _scroll position updates into subscriptions + // that live in lifetime() and die after most of the fields, like the + // one from setupStories that uses the already destroyed _stories. + // + // So destroy the whole scroll now, while all the fields are alive. + _scroll.destroy(); } } // namespace Dialogs