mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
parent
bd4f993292
commit
ecedce0c2f
1 changed files with 14 additions and 12 deletions
|
@ -2030,7 +2030,6 @@ void HistoryWidget::showHistory(
|
||||||
_membersDropdown.destroy();
|
_membersDropdown.destroy();
|
||||||
_scrollToAnimation.stop();
|
_scrollToAnimation.stop();
|
||||||
|
|
||||||
clearAllLoadRequests();
|
|
||||||
setHistory(nullptr);
|
setHistory(nullptr);
|
||||||
_list = nullptr;
|
_list = nullptr;
|
||||||
_peer = nullptr;
|
_peer = nullptr;
|
||||||
|
@ -2241,10 +2240,6 @@ void HistoryWidget::setHistory(History *history) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto wasHistory = base::take(_history);
|
|
||||||
const auto wasMigrated = base::take(_migrated);
|
|
||||||
|
|
||||||
// Unload lottie animations.
|
|
||||||
const auto unloadHeavyViewParts = [](History *history) {
|
const auto unloadHeavyViewParts = [](History *history) {
|
||||||
if (history) {
|
if (history) {
|
||||||
history->owner().unloadHeavyViewParts(
|
history->owner().unloadHeavyViewParts(
|
||||||
|
@ -2252,13 +2247,19 @@ void HistoryWidget::setHistory(History *history) {
|
||||||
history->forceFullResize();
|
history->forceFullResize();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
unloadHeavyViewParts(wasHistory);
|
if (_history) {
|
||||||
unloadHeavyViewParts(wasMigrated);
|
unregisterDraftSources();
|
||||||
|
clearAllLoadRequests();
|
||||||
unregisterDraftSources();
|
const auto wasHistory = base::take(_history);
|
||||||
_history = history;
|
const auto wasMigrated = base::take(_migrated);
|
||||||
_migrated = _history ? _history->migrateFrom() : nullptr;
|
unloadHeavyViewParts(wasHistory);
|
||||||
registerDraftSource();
|
unloadHeavyViewParts(wasMigrated);
|
||||||
|
}
|
||||||
|
if (history) {
|
||||||
|
_history = history;
|
||||||
|
_migrated = _history ? _history->migrateFrom() : nullptr;
|
||||||
|
registerDraftSource();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::unregisterDraftSources() {
|
void HistoryWidget::unregisterDraftSources() {
|
||||||
|
@ -7412,6 +7413,7 @@ HistoryWidget::~HistoryWidget() {
|
||||||
session().api().saveDraftToCloudDelayed(_history);
|
session().api().saveDraftToCloudDelayed(_history);
|
||||||
|
|
||||||
clearAllLoadRequests();
|
clearAllLoadRequests();
|
||||||
|
setHistory(nullptr);
|
||||||
unregisterDraftSources();
|
unregisterDraftSources();
|
||||||
}
|
}
|
||||||
setTabbedPanel(nullptr);
|
setTabbedPanel(nullptr);
|
||||||
|
|
Loading…
Add table
Reference in a new issue