aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-12-17 23:06:35 +0100
committerdec05eba <dec05eba@protonmail.com>2022-12-17 23:06:35 +0100
commit88cd57714af6bfc307d41f9dfa74da45600d51e0 (patch)
tree708451908928a4da1771320f36f30218f5eff63c /src
parent35e754008bb449c52cb54ccbf2ed9a21e97009c5 (diff)
Only unload the exact thumbnail that is not visible on the screen
Diffstat (limited to 'src')
-rw-r--r--src/AsyncImageLoader.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp
index 4fe7f0d..95bc9ca 100644
--- a/src/AsyncImageLoader.cpp
+++ b/src/AsyncImageLoader.cpp
@@ -315,10 +315,8 @@ namespace QuickMedia {
// TODO: Instead of generating a new hash everytime to access thumbnail, cache the hash of the thumbnail url.
// TODO: Cache this resize_url
auto &thumbnail_data = thumbnails[url + "_" + std::to_string(resize_target_size.x) + "x" + std::to_string(resize_target_size.y)];
- if(!thumbnail_data) {
+ if(!thumbnail_data)
thumbnail_data = std::make_shared<ThumbnailData>();
- thumbnail_data->url = url;
- }
thumbnail_data->counter = counter;
if(thumbnail_data->thumbnail_path.data.empty()) {
@@ -361,7 +359,7 @@ namespace QuickMedia {
if(download.read_program.pid == -1)
continue;
- if(download.url == it->second->url) {
+ if(download.thumbnail_data.get() == it->second.get()) {
reset_download(download);
break;
}
@@ -369,7 +367,7 @@ namespace QuickMedia {
}
image_thumbnail_create_queue.erase_if([&it](ThumbnailLoadData &load_data) {
- return load_data.path.data == it->second->url;
+ return load_data.thumbnail_data.get() == it->second.get();
});
it = thumbnails.erase(it);