aboutsummaryrefslogtreecommitdiff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Cache.cpp')
-rw-r--r--src/Cache.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp
index 074b7bc..e5d910c 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -5,6 +5,8 @@
#include "../include/Gif.hpp"
#include "../include/Chatbar.hpp"
#include "../include/WebPagePreview.hpp"
+#include "../include/ImagePreview.hpp"
+#include "../include/StringUtils.hpp"
#include <boost/filesystem/convenience.hpp>
#include <unordered_map>
#include <process.hpp>
@@ -267,11 +269,21 @@ namespace dchat
{
case ContentByUrlResult::CachedType::TEXTURE:
{
+ if(ImagePreview::getPreviewContentPtr() == it->second.texture)
+ {
+ ++it;
+ continue;
+ }
delete it->second.texture;
break;
}
case ContentByUrlResult::CachedType::GIF:
{
+ if(ImagePreview::getPreviewContentPtr() == it->second.texture)
+ {
+ ++it;
+ continue;
+ }
delete it->second.gif;
break;
}
@@ -311,18 +323,6 @@ namespace dchat
}
}
- static string stringReplaceChar(const string &str, const string &from, const string &to)
- {
- string result = str;
- size_t pos = 0;
- while((pos = result.find(from, pos)) != string::npos)
- {
- result.replace(pos, from.size(), to);
- pos += to.size();
- }
- return result;
- }
-
const ContentByUrlResult Cache::getContentByUrl(const string &url, int downloadLimitBytes)
{
lock_guard<mutex> lock(imageDownloadMutex);