small fix

This commit is contained in:
Patrick von Reth 2014-07-22 14:32:27 +02:00
parent 1cd2e62aa9
commit d445f5c14d
1 changed files with 8 additions and 3 deletions

View File

@ -80,9 +80,12 @@ QString IconData::localUrl()
if(!m_isLocalFile && !s_localImageCache.contains(m_localUrl)) if(!m_isLocalFile && !s_localImageCache.contains(m_localUrl))
{ {
QImage img = image(); QImage img = image();
img.save(m_localUrl ,"PNG"); if(!s_localImageCache.contains(m_localUrl))//double check as image() could have called download
s_localImageCache.insert(m_localUrl); {
snoreDebug( SNORE_DEBUG ) << m_localUrl << "added to cache"; img.save(m_localUrl ,"PNG");
s_localImageCache.insert(m_localUrl);
snoreDebug( SNORE_DEBUG ) << m_localUrl << "added to cache";
}
} }
return m_localUrl; return m_localUrl;
} }
@ -107,6 +110,8 @@ void IconData::download()
{ {
m_img = QImage::fromData(reply->readAll(), "PNG"); m_img = QImage::fromData(reply->readAll(), "PNG");
m_img.save(m_localUrl,"PNG"); m_img.save(m_localUrl,"PNG");
s_localImageCache.insert(m_localUrl);
snoreDebug( SNORE_DEBUG ) << m_localUrl << "added to cache";
} }
} }
else else