summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/imagedownloader.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/imagedownloader.cpp b/core/imagedownloader.cpp
index dc74a1e27..d4dd85922 100644
--- a/core/imagedownloader.cpp
+++ b/core/imagedownloader.cpp
@@ -4,6 +4,7 @@
#include "qthelper.h"
#include "imagedownloader.h"
#include <unistd.h>
+#include <QString>
#include <QtConcurrent>
@@ -75,10 +76,17 @@ void ImageDownloader::saveImage(QNetworkReply *reply)
}
+QSet<QString> queuedPictures;
+QMutex pictureQueueMutex;
+
void loadPicture(struct picture *picture, bool fromHash)
{
if (!picture)
return;
+ QMutexLocker locker(&pictureQueueMutex);
+ if (queuedPictures.contains(QString(picture->filename)))
+ return;
+ queuedPictures.insert(QString(picture->filename));
ImageDownloader download(picture);
download.load(fromHash);
}