diff options
author | jghali <jghali@11d20701-8431-0410-a711-e3c959e3b870> | 2012-07-13 10:59:14 +0000 |
---|---|---|
committer | jghali <jghali@11d20701-8431-0410-a711-e3c959e3b870> | 2012-07-13 10:59:14 +0000 |
commit | 92fcd333aa3e139b16838abbb2c424f2ba6c7d2e (patch) | |
tree | 370329f9a21d30aa0ffc53a912a60fe365f71217 | |
parent | 16a456513f73d1d1aebc99699b9da4db43671aab (diff) | |
download | scribus-92fcd333aa3e139b16838abbb2c424f2ba6c7d2e.tar.gz scribus-92fcd333aa3e139b16838abbb2c424f2ba6c7d2e.tar.xz scribus-92fcd333aa3e139b16838abbb2c424f2ba6c7d2e.zip |
fix sometime incorrect caching of color profiles
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17712 11d20701-8431-0410-a711-e3c959e3b870
-rw-r--r-- | scribus/colormgmt/sccolorprofilecache.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/scribus/colormgmt/sccolorprofilecache.cpp b/scribus/colormgmt/sccolorprofilecache.cpp index 19efdbd..6099933 100644 --- a/scribus/colormgmt/sccolorprofilecache.cpp +++ b/scribus/colormgmt/sccolorprofilecache.cpp @@ -9,11 +9,17 @@ for which a new license (GPL+exception) is in place. 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 @@ void ScColorProfileCache::removeProfile(const ScColorProfile& profile) 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)
|