r17712 by jghali - fix sometime incorrect caching of color profiles
scribus-commit
scribus-commit at lists.scribus.net
Fri Jul 13 10:59:14 UTC 2012
Author: jghali
Date: Fri Jul 13 10:59:14 2012
New Revision: 17712
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17712
Log:
fix sometime incorrect caching of color profiles
Modified:
branches/Version14x/Scribus/scribus/colormgmt/sccolorprofilecache.cpp
Modified: branches/Version14x/Scribus/scribus/colormgmt/sccolorprofilecache.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17712&path=/branches/Version14x/Scribus/scribus/colormgmt/sccolorprofilecache.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/colormgmt/sccolorprofilecache.cpp (original)
+++ branches/Version14x/Scribus/scribus/colormgmt/sccolorprofilecache.cpp Fri Jul 13 10:59:14 2012
@@ -9,11 +9,17 @@
void ScColorProfileCache::addProfile(const ScColorProfile& profile)
{
QString path = profile.profilePath();
- if (!path.isEmpty())
+ if (path.isEmpty())
+ return;
+
+ QMap<QString, QWeakPointer<ScColorProfileData> >::iterator iter = m_profileMap.find(path);
+ if (iter != m_profileMap.end())
{
- if (!m_profileMap.contains(path))
- m_profileMap.insert(path, profile.weakRef());
+ QSharedPointer<ScColorProfileData> strongRef = iter.value().toStrongRef();
+ if (strongRef) return;
}
+
+ m_profileMap.insert(path, profile.weakRef());
}
void ScColorProfileCache::removeProfile(const QString& profilePath)
@@ -28,7 +34,13 @@
bool ScColorProfileCache::contains(const QString& profilePath)
{
- return m_profileMap.contains(profilePath);
+ QMap<QString, QWeakPointer<ScColorProfileData> >::iterator iter = m_profileMap.find(profilePath);
+ if (iter != m_profileMap.end())
+ {
+ QSharedPointer<ScColorProfileData> strongRef = iter.value().toStrongRef();
+ return (!strongRef.isNull());
+ }
+ return false;
}
ScColorProfile ScColorProfileCache::profile(const QString& profilePath)
More information about the scribus-commit
mailing list