2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Fix download task finalizing.

This commit is contained in:
John Preston
2020-04-17 18:02:10 +04:00
parent 3797753d16
commit cbb9657044
5 changed files with 30 additions and 16 deletions

View File

@@ -617,10 +617,17 @@ void DocumentData::updateThumbnails(
|| _thumbnailLocation.height() < thumbnail.location.height())) {
_thumbnailLocation = thumbnail.location;
_thumbnailByteSize = thumbnail.bytesCount;
if (_thumbnailLoader) {
if (!thumbnail.preloaded.isNull()) {
_thumbnailLoader = nullptr;
if (const auto media = activeMediaView()) {
media->setThumbnail(thumbnail.preloaded);
}
} else if (_thumbnailLoader) {
const auto origin = base::take(_thumbnailLoader)->fileOrigin();
loadThumbnail(origin);
// #TODO optimize replace thumbnail in activeMediaView().
}
if (!thumbnail.bytes.isEmpty()) {
// #TODO optimize put to cache
}
}
}