Commit 6478053c authored by Maik Qualmann's avatar Maik Qualmann

further changes to the preview loader

CCBUGS: 427333
parent 045b5b84
......@@ -180,8 +180,6 @@ void SharedLoadingTask::execute()
}
}
bool loadingImage = false;
if (continueQuery() && m_img.isNull())
{
// find possible running loading process
......@@ -225,12 +223,13 @@ void SharedLoadingTask::execute()
// m_img is now set to the result
}
else
}
if (continueQuery() && m_img.isNull())
{
{
LoadingCache::CacheLock lock(cache);
loadingImage = true;
// Neither in cache, nor currently loading in different thread.
// Load it here and now, add this LoadingProcess to cache list.
......@@ -241,16 +240,11 @@ void SharedLoadingTask::execute()
cache->notifyNewLoadingProcess(this, m_loadingDescription);
}
}
if (loadingImage || (continueQuery() && m_img.isNull()))
{
// load image
m_img = DImg(m_loadingDescription.filePath, this, m_loadingDescription.rawDecodingSettings);
if (loadingImage || continueQuery())
{
{
LoadingCache::CacheLock lock(cache);
......@@ -297,7 +291,6 @@ void SharedLoadingTask::execute()
QThread::msleep(10);
}
}
}
// following the golden rule to avoid deadlocks, do this when CacheLock is not held
......
......@@ -108,8 +108,6 @@ void PreviewLoadingTask::execute()
}
}
bool loadingImage = false;
if (continueQuery() && m_img.isNull())
{
// find possible running loading process
......@@ -153,12 +151,13 @@ void PreviewLoadingTask::execute()
// m_img is now set to the result
}
else
}
if (continueQuery() && m_img.isNull())
{
{
LoadingCache::CacheLock lock(cache);
loadingImage = true;
// Neither in cache, nor currently loading in different thread.
// Load it here and now, add this LoadingProcess to cache list.
......@@ -169,10 +168,7 @@ void PreviewLoadingTask::execute()
cache->notifyNewLoadingProcess(this, m_loadingDescription);
}
}
if (loadingImage || (continueQuery() && m_img.isNull()))
{
// Preview is not in cache, we will load image from file.
DImg::FORMAT format = DImg::fileFormat(m_loadingDescription.filePath);
......@@ -321,8 +317,6 @@ void PreviewLoadingTask::execute()
}
}
if (loadingImage || continueQuery())
{
if (!m_img.isNull() && MetaEngineSettings::instance()->settings().exifRotate)
{
m_img.exifRotate(m_loadingDescription.filePath);
......@@ -374,7 +368,6 @@ void PreviewLoadingTask::execute()
QThread::msleep(10);
}
}
}
// following the golden rule to avoid deadlocks, do this when CacheLock is not held
......
......@@ -115,8 +115,6 @@ void ThumbnailLoadingTask::execute()
}
}
bool loadingImage = false;
if (continueQuery() && m_qimage.isNull())
{
// find possible running loading process
......@@ -155,12 +153,13 @@ void ThumbnailLoadingTask::execute()
// m_qimage is now set to the result
}
else
}
if (continueQuery() && m_qimage.isNull())
{
{
LoadingCache::CacheLock lock(cache);
loadingImage = true;
// Neither in cache, nor currently loading in different thread.
// Load it here and now, add this LoadingProcess to cache list.
......@@ -171,10 +170,7 @@ void ThumbnailLoadingTask::execute()
cache->notifyNewLoadingProcess(this, m_loadingDescription);
}
}
if (loadingImage || (continueQuery() && m_qimage.isNull()))
{
// Load or create thumbnail
setupCreator();
......@@ -200,8 +196,6 @@ void ThumbnailLoadingTask::execute()
}
}
if (loadingImage || continueQuery())
{
{
LoadingCache::CacheLock lock(cache);
......@@ -241,7 +235,6 @@ void ThumbnailLoadingTask::execute()
QThread::msleep(10);
}
}
}
// following the golden rule to avoid deadlocks, do this when CacheLock is not held
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment