Fix crash in leaving Recent Actions with GIFs.
This commit is contained in:
parent
e5ac7a1416
commit
a9422111a2
|
@ -632,6 +632,9 @@ void InnerWidget::saveState(not_null<SectionMemento*> 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),
|
||||
|
|
|
@ -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<HistoryView::ElementDelegate*> delegate,
|
||||
not_null<History*> history,
|
||||
|
|
|
@ -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<HistoryView::ElementDelegate*> delegate);
|
||||
void clearView();
|
||||
|
||||
private:
|
||||
HistoryItem *_data = nullptr;
|
||||
|
|
Loading…
Reference in New Issue