aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Härer <markus.haerer@gmx.net>2024-01-07 03:01:03 +0100
committerGitHub <noreply@github.com>2024-01-07 03:01:03 +0100
commitfae98b3669f47217c108b154987b735bca20fe2b (patch)
tree86e172686d640972a499230c5adcd770d5f16da7
parent15b92465cd7ee4d6d248f5783314e8e51e5c4a59 (diff)
parent70caaa44631829c784ca0d8d79d3e07bb4259cd7 (diff)
Merge pull request #24447 from neo1973/backport_24433
[BP][CImageFile] Fix texture cache handling
-rw-r--r--xbmc/TextureCache.cpp3
-rw-r--r--xbmc/filesystem/ImageFile.cpp8
2 files changed, 9 insertions, 2 deletions
diff --git a/xbmc/TextureCache.cpp b/xbmc/TextureCache.cpp
index beca7cf9fd..6eeb098f8f 100644
--- a/xbmc/TextureCache.cpp
+++ b/xbmc/TextureCache.cpp
@@ -203,9 +203,10 @@ bool CTextureCache::CacheImage(const std::string &image, CTextureDetails &detail
return !path.empty();
}
-void CTextureCache::ClearCachedImage(const std::string &url, bool deleteSource /*= false */)
+void CTextureCache::ClearCachedImage(const std::string& image, bool deleteSource /*= false */)
{
//! @todo This can be removed when the texture cache covers everything.
+ const std::string url = CTextureUtils::UnwrapImageURL(image);
std::string path = deleteSource ? url : "";
std::string cachedFile;
if (ClearCachedTexture(url, cachedFile))
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))