]> Git trees. - libqmvoc.git/commitdiff
fix crash when deleting document - removal from word type would try to access already...
authorFrederik Gladhorn <gladhorn@kde.org>
Mon, 19 Jan 2009 00:16:17 +0000 (00:16 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Mon, 19 Jan 2009 00:16:17 +0000 (00:16 +0000)
Thanks Albert!!!!!

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=913263

keduvocdocument/keduvocexpression.cpp
keduvocdocument/keduvocwordtype.cpp

index 10e4ee5183905367fe8bf81858a52023efc2b112..63d5ac3510a43b64d5bded2b76aefe92ff20df07 100644 (file)
@@ -45,7 +45,10 @@ public:
 
 KEduVocExpression::KEduVocExpressionPrivate::~KEduVocExpressionPrivate()
 {
-    qDeleteAll(m_translations);
+    QMap <int, KEduVocTranslation*> translations = m_translations;
+    // empty the translations map, otherwise removal from word type will try to access them again when they don't exist any more
+    m_translations.clear();
+    qDeleteAll(translations);
 }
 
 KEduVocExpression::KEduVocExpressionPrivate::KEduVocExpressionPrivate(const KEduVocExpressionPrivate & other)
index e5e32a8c0402eb9f3e10f35cd9ead78b0c818ba4..65b06386c3f30a66d5be896bf0b5c44e56fc4710 100644 (file)
@@ -91,7 +91,6 @@ void KEduVocWordType::removeTranslation(KEduVocTranslation* translation)
         }
     }
 
-    // TODO translation(i)'s d pointer can be null. How should we fix this?
     // remove from cache
     bool found = false;
     foreach(int i, translation->entry()->translationIndices()) {