Don't forget current item in MediaView.

This commit is contained in:
John Preston 2017-10-10 20:41:32 +01:00
parent a08dd1f6e1
commit aa260d263b
1 changed files with 8 additions and 6 deletions

View File

@ -2324,6 +2324,7 @@ void MediaView::preloadData(int32 delta) {
auto till = *_index + (delta ? delta * kPreloadCount : 1); auto till = *_index + (delta ? delta * kPreloadCount : 1);
if (from > till) std::swap(from, till); if (from > till) std::swap(from, till);
if (delta != 0) {
auto forgetIndex = *_index - delta * 2; auto forgetIndex = *_index - delta * 2;
auto entity = entityByIndex(forgetIndex); auto entity = entityByIndex(forgetIndex);
if (auto photo = base::get_if<not_null<PhotoData*>>(&entity.data)) { if (auto photo = base::get_if<not_null<PhotoData*>>(&entity.data)) {
@ -2331,6 +2332,7 @@ void MediaView::preloadData(int32 delta) {
} else if (auto document = base::get_if<not_null<DocumentData*>>(&entity.data)) { } else if (auto document = base::get_if<not_null<DocumentData*>>(&entity.data)) {
(*document)->forget(); (*document)->forget();
} }
}
for (auto index = from; index != till; ++index) { for (auto index = from; index != till; ++index) {
auto entity = entityByIndex(index); auto entity = entityByIndex(index);