diff options
author | Robert C. Helling <helling@atdotde.de> | 2016-12-02 23:43:30 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-12-04 05:37:16 +0900 |
commit | 1ab5db3726fcbb5c05216e2f5b5ff59b2d95f3c2 (patch) | |
tree | cfd277905ed1d04225ac599c337f9913b55783b5 /core | |
parent | cac40bd65965d46f4575e54761a8a516e0932096 (diff) | |
download | subsurface-1ab5db3726fcbb5c05216e2f5b5ff59b2d95f3c2.tar.gz |
Empty image hashes are not valid
I don't know how those arose in the first place, but an
empty QByteArray is never a valid hash value for an image. So
we should not store those in our translation tables and also
get rid of them when loading the tables from disk.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/qthelper.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 0628dd2e3..ad1780144 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -1026,6 +1026,20 @@ void read_hashes() stream >> thumbnailCache; hashfile.close(); } + localFilenameOf.remove(""); + QMutableHashIterator<QString, QByteArray> iter(hashOf); + while (iter.hasNext()) { + iter.next(); + if (iter.value().isEmpty()) + iter.remove(); + } + qDebug() << "localFilenameOf empty" << localFilenameOf[""]; + + QHash<QString, QImage>::const_iterator i = thumbnailCache.constBegin(); + while (i != thumbnailCache.constEnd()) { + qDebug() << i.key() << *i; + ++i; + } } void write_hashes() @@ -1046,6 +1060,8 @@ void write_hashes() void add_hash(const QString filename, QByteArray hash) { + if (hash.isEmpty()) + return; QMutexLocker locker(&hashOfMutex); hashOf[filename] = hash; localFilenameOf[hash] = filename; |