2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +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

@@ -267,20 +267,20 @@ void Inner::clearSelection() {
void Inner::hideFinish(bool completely) {
if (completely) {
auto itemForget = [](auto &item) {
if (auto document = item->getDocument()) {
document->forget();
const auto unload = [](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();
}
};
clearInlineRows(false);
for_const (auto &item, _inlineLayouts) {
itemForget(item.second);
for (const auto &[result, layout] : _inlineLayouts) {
unload(layout);
}
}
}