mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Dive pictures: remove cache_picture() call in dive_add_picture()
When adding a picture to a dive, cache_picture() was called, which calculated the hash of the picture in a background-thread. This made tests occasionally fail, because the tests depended on the filename-to-localfilename being overwritten in a call running in a different thread. Depending on which thread finished first, the test succeeded or failed. The easiest way to circumvent this problem is to remove the cache_picture() call. The hash will be calculated anyway with the thumbnails. And the only function of the hash is the "find moved images" function. Which is not an issue here, because the user just loaded the images from disk. Reported-by: Jan Iversen <jani@apache.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
780530f32e
commit
2e8f506635
3 changed files with 0 additions and 15 deletions
|
@ -3838,7 +3838,6 @@ void dive_add_picture(struct dive *dive, struct picture *newpic)
|
|||
pic_ptr = &(*pic_ptr)->next;
|
||||
newpic->next = *pic_ptr;
|
||||
*pic_ptr = newpic;
|
||||
cache_picture(newpic);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1216,12 +1216,6 @@ void learnHash(const QString &originalName, const QString &localName, const QByt
|
|||
hashOf[originalName] = hash;
|
||||
}
|
||||
|
||||
static bool haveHash(const QString &filename)
|
||||
{
|
||||
QMutexLocker locker(&hashOfMutex);
|
||||
return hashOf.contains(filename);
|
||||
}
|
||||
|
||||
QString localFilePath(const QString &originalFilename)
|
||||
{
|
||||
QMutexLocker locker(&hashOfMutex);
|
||||
|
@ -1241,13 +1235,6 @@ void hashPicture(QString filename)
|
|||
mark_divelist_changed(true);
|
||||
}
|
||||
|
||||
extern "C" void cache_picture(struct picture *picture)
|
||||
{
|
||||
QString filename = picture->filename;
|
||||
if (!haveHash(filename))
|
||||
QtConcurrent::run(hashPicture, filename);
|
||||
}
|
||||
|
||||
QStringList imageExtensionFilters() {
|
||||
QStringList filters;
|
||||
foreach (QString format, QImageReader::supportedImageFormats()) {
|
||||
|
|
|
@ -113,7 +113,6 @@ char *hashstring(const char *filename);
|
|||
void register_hash(const char *filename, const char *hash);
|
||||
char *move_away(const char *path);
|
||||
const char *local_file_path(struct picture *picture);
|
||||
void cache_picture(struct picture *picture);
|
||||
char *cloud_url();
|
||||
char *hashfile_name_string();
|
||||
char *picturedir_string();
|
||||
|
|
Loading…
Add table
Reference in a new issue