aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Härer <markus.haerer@gmx.net>2024-01-05 00:38:11 +0100
committerMarkus Härer <markus.haerer@gmx.net>2024-01-07 02:02:13 +0100
commit70caaa44631829c784ca0d8d79d3e07bb4259cd7 (patch)
tree86e172686d640972a499230c5adcd770d5f16da7
parent64808b264688f0ae72aa8c710d810e3e8fd3b04e (diff)
CImageFile: Remove missing thumbs from CTextureCache
If someone deletes the ~/.kodi/userdata/Thumbnails folder but not the TexturesXX.db then CImageFile wouldn't cache the image again and loading of the image fails, e.g. when using the JSON API to load album art via CHTTPImageHandler. By removing the entry from the CTextureCache and continung the current operation can succeed and the image will simply get cached again the next time it is opened. (cherry picked from commit 9f02ffd0ae693dcdcd5d6e8bb715134e8efc3803)
-rw-r--r--xbmc/filesystem/ImageFile.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/xbmc/filesystem/ImageFile.cpp b/xbmc/filesystem/ImageFile.cpp
index 969150975b..bb1e23acd2 100644
--- a/xbmc/filesystem/ImageFile.cpp
+++ b/xbmc/filesystem/ImageFile.cpp
@@ -45,7 +45,13 @@ bool CImageFile::Exists(const CURL& url)
std::string cachedFile =
CServiceBroker::GetTextureCache()->CheckCachedImage(url.Get(), needsRecaching);
if (!cachedFile.empty())
- return CFile::Exists(cachedFile, false);
+ {
+ if (CFile::Exists(cachedFile, false))
+ return true;
+ else
+ // Remove from cache so it gets cached again on next Open()
+ CServiceBroker::GetTextureCache()->ClearCachedImage(url.Get());
+ }
// need to check if the original can be cached on demand and that the file exists
if (!CTextureCache::CanCacheImageURL(url))