2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Don't unload all media on switching between chats.

This commit is contained in:
John Preston
2018-10-23 16:57:43 +04:00
parent 959859f57c
commit 8e7117fa22
21 changed files with 61 additions and 83 deletions

View File

@@ -405,24 +405,24 @@ void GifsListWidget::processHideFinished() {
}
void GifsListWidget::processPanelHideFinished() {
auto itemForget = [](auto &item) {
if (auto document = item->getDocument()) {
document->forget();
const auto itemForget = [](const auto &item) {
if (const auto document = item->getDocument()) {
document->unload();
}
if (auto photo = item->getPhoto()) {
photo->forget();
if (const auto photo = item->getPhoto()) {
photo->unload();
}
if (auto result = item->getResult()) {
result->forget();
if (const auto result = item->getResult()) {
result->unload();
}
};
// Preserve panel state through visibility toggles.
//clearInlineRows(false);
for_const (auto &item, _gifLayouts) {
itemForget(item.second);
for (const auto &[document, layout] : _gifLayouts) {
itemForget(layout);
}
for_const (auto &item, _inlineLayouts) {
itemForget(item.second);
for (const auto &[document, layout] : _inlineLayouts) {
itemForget(layout);
}
}