mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-01 06:55:58 +00:00
Fix crash in history switching.
This commit is contained in:
@@ -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;
|
||||||
|
Reference in New Issue
Block a user