mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 23:00:58 +00:00
Fix crash in AdminLog view with deleted delegates.
This commit is contained in:
parent
9aa2831fef
commit
d6e1862c08
@ -531,6 +531,9 @@ void InnerWidget::saveState(not_null<SectionMemento*> memento) {
|
|||||||
|
|
||||||
void InnerWidget::restoreState(not_null<SectionMemento*> memento) {
|
void InnerWidget::restoreState(not_null<SectionMemento*> memento) {
|
||||||
_items = memento->takeItems();
|
_items = memento->takeItems();
|
||||||
|
for (auto &item : _items) {
|
||||||
|
item.refreshView(this);
|
||||||
|
}
|
||||||
_itemsByIds = memento->takeItemsByIds();
|
_itemsByIds = memento->takeItemsByIds();
|
||||||
if (auto manager = memento->takeIdManager()) {
|
if (auto manager = memento->takeIdManager()) {
|
||||||
_idManager = std::move(manager);
|
_idManager = std::move(manager);
|
||||||
|
@ -195,9 +195,9 @@ auto GenerateBannedChangeText(const TextWithEntities &user, const MTPChannelBann
|
|||||||
lt_date,
|
lt_date,
|
||||||
langDateTime(ParseDateTime(newUntil)));
|
langDateTime(ParseDateTime(newUntil)));
|
||||||
auto result = lng_admin_log_restricted__generic(
|
auto result = lng_admin_log_restricted__generic(
|
||||||
lt_user,
|
lt_user,
|
||||||
user,
|
user,
|
||||||
lt_until,
|
lt_until,
|
||||||
TextWithEntities { untilText });
|
TextWithEntities { untilText });
|
||||||
|
|
||||||
static auto phraseMap = std::map<Flags, LangKey> {
|
static auto phraseMap = std::map<Flags, LangKey> {
|
||||||
@ -317,6 +317,11 @@ OwnedItem::~OwnedItem() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OwnedItem::refreshView(
|
||||||
|
not_null<HistoryView::ElementDelegate*> delegate) {
|
||||||
|
_view = _data->createView(delegate);
|
||||||
|
}
|
||||||
|
|
||||||
void GenerateItems(
|
void GenerateItems(
|
||||||
not_null<HistoryView::ElementDelegate*> delegate,
|
not_null<HistoryView::ElementDelegate*> delegate,
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
|
@ -46,6 +46,8 @@ public:
|
|||||||
return get();
|
return get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void refreshView(not_null<HistoryView::ElementDelegate*> delegate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HistoryItem *_data = nullptr;
|
HistoryItem *_data = nullptr;
|
||||||
std::unique_ptr<HistoryView::Element> _view;
|
std::unique_ptr<HistoryView::Element> _view;
|
||||||
|
Loading…
Reference in New Issue
Block a user