mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-22 00:57:09 +02:00
Fix crash in history switching.
This commit is contained in:
parent
8788692fb3
commit
43559fb6b7
1 changed files with 9 additions and 3 deletions
|
@ -491,7 +491,10 @@ HistoryWidget::HistoryWidget(
|
||||||
|
|
||||||
session().data().viewResizeRequest(
|
session().data().viewResizeRequest(
|
||||||
) | rpl::start_with_next([=](not_null<HistoryView::Element*> view) {
|
) | rpl::start_with_next([=](not_null<HistoryView::Element*> view) {
|
||||||
if (view->data()->mainView() == view) {
|
const auto item = view->data();
|
||||||
|
const auto history = item->history();
|
||||||
|
if (item->mainView() == view
|
||||||
|
&& (history == _history || history == _migrated)) {
|
||||||
updateHistoryGeometry();
|
updateHistoryGeometry();
|
||||||
}
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
@ -2238,6 +2241,9 @@ void HistoryWidget::setHistory(History *history) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto wasHistory = base::take(_history);
|
||||||
|
const auto wasMigrated = base::take(_migrated);
|
||||||
|
|
||||||
// Unload lottie animations.
|
// Unload lottie animations.
|
||||||
const auto unloadHeavyViewParts = [](History *history) {
|
const auto unloadHeavyViewParts = [](History *history) {
|
||||||
if (history) {
|
if (history) {
|
||||||
|
@ -2246,8 +2252,8 @@ void HistoryWidget::setHistory(History *history) {
|
||||||
history->forceFullResize();
|
history->forceFullResize();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
unloadHeavyViewParts(_history);
|
unloadHeavyViewParts(wasHistory);
|
||||||
unloadHeavyViewParts(_migrated);
|
unloadHeavyViewParts(wasMigrated);
|
||||||
|
|
||||||
unregisterDraftSources();
|
unregisterDraftSources();
|
||||||
_history = history;
|
_history = history;
|
||||||
|
|
Loading…
Add table
Reference in a new issue