From 49b59d73bef146113a8a71902bbad877c9057ab2 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 27 Nov 2023 12:20:13 +0400 Subject: [PATCH] Fix comments loading. Fixes #25889. --- .../SourceFiles/history/view/history_view_list_widget.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 3d1ff4df7..ff973ed11 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -3788,8 +3788,6 @@ void ListWidget::viewReplaced(not_null was, Element *now) { } void ListWidget::itemRemoved(not_null item) { - saveScrollState(); - if (_reactionsItem.current() == item) { _reactionsItem = nullptr; } @@ -3806,6 +3804,12 @@ void ListWidget::itemRemoved(not_null item) { if (i == end(_views)) { return; } + + saveScrollState(); + const auto guard = gsl::finally([&] { + restoreScrollState(); + }); + const auto view = i->second.get(); _items.erase( ranges::remove(_items, view, [](auto view) { return view.get(); }),