From 92fcd333aa3e139b16838abbb2c424f2ba6c7d2e Mon Sep 17 00:00:00 2001 From: jghali Date: Fri, 13 Jul 2012 10:59:14 +0000 Subject: fix sometime incorrect caching of color profiles git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17712 11d20701-8431-0410-a711-e3c959e3b870 --- scribus/colormgmt/sccolorprofilecache.cpp | 20 ++++++++++++++++---- 1 file 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 >::iterator iter = m_profileMap.find(path); + if (iter != m_profileMap.end()) { - if (!m_profileMap.contains(path)) - m_profileMap.insert(path, profile.weakRef()); + QSharedPointer 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 >::iterator iter = m_profileMap.find(profilePath); + if (iter != m_profileMap.end()) + { + QSharedPointer strongRef = iter.value().toStrongRef(); + return (!strongRef.isNull()); + } + return false; } ScColorProfile ScColorProfileCache::profile(const QString& profilePath) -- cgit