diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index e9ee9b9ebc..bbf58c9d78 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -632,6 +632,9 @@ void InnerWidget::saveState(not_null memento) { memento->setAdminsCanEdit(std::move(_adminsCanEdit)); memento->setSearchQuery(std::move(_searchQuery)); if (!_filterChanged) { + for (auto &item : _items) { + item.clearView(); + } memento->setItems( base::take(_items), base::take(_eventIds), diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index 3f6234d646..b0b878b4b6 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -480,7 +480,7 @@ OwnedItem &OwnedItem::operator=(OwnedItem &&other) { } OwnedItem::~OwnedItem() { - _view = nullptr; + clearView(); if (_data) { _data->destroy(); } @@ -491,6 +491,10 @@ void OwnedItem::refreshView( _view = _data->createView(delegate); } +void OwnedItem::clearView() { + _view = nullptr; +} + void GenerateItems( not_null delegate, not_null history, diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.h b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.h index ceaa50bc3c..c7a74b8fad 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.h +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.h @@ -37,17 +37,18 @@ public: OwnedItem &operator=(OwnedItem &&other); ~OwnedItem(); - HistoryView::Element *get() const { + [[nodiscard]] HistoryView::Element *get() const { return _view.get(); } - HistoryView::Element *operator->() const { + [[nodiscard]] HistoryView::Element *operator->() const { return get(); } - operator HistoryView::Element*() const { + [[nodiscard]] operator HistoryView::Element*() const { return get(); } void refreshView(not_null delegate); + void clearView(); private: HistoryItem *_data = nullptr;