[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeutils/kgpg/core
From:       Rolf Eike Beer <kde () opensource ! sf-tec ! de>
Date:       2010-08-22 8:55:34
Message-ID: 20100822085534.D5E69AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1166620 by dakon:

fix another crash because of calling functions of an object in deletion when refreshing keys

CCBUG:248604

forward-port of r1166589

 M  +3 -2      KGpgKeyNode.cpp  
 M  +1 -1      KGpgKeyNode.h  
 M  +1 -3      KGpgRefNode.cpp  
 M  +9 -1      KGpgRefNode.h  


--- trunk/KDE/kdeutils/kgpg/core/KGpgKeyNode.cpp #1166619:1166620
@@ -25,11 +25,12 @@
 #include "kgpginterface.h"
 #include "kgpgitemmodel.h"
 #include "kgpgsettings.h"
+#include "KGpgRootNode.h"
 #include "KGpgSubkeyNode.h"
 #include "KGpgUatNode.h"
 #include "KGpgUidNode.h"
 
-KGpgKeyNode::KGpgKeyNode(KGpgExpandableNode *parent, const KgpgCore::KgpgKey &k)
+KGpgKeyNode::KGpgKeyNode(KGpgRootNode *parent, const KgpgCore::KgpgKey &k)
 	: KGpgSignableNode(parent),
 	m_key(new KgpgCore::KgpgKey(k)),
 	m_signs(0)
@@ -39,7 +40,7 @@
 KGpgKeyNode::~KGpgKeyNode()
 {
 	foreach (KGpgRefNode *nd, m_refs) {
-		nd->unRef();
+		nd->unRef(m_parent->toRootNode());
 	}
 }
 
--- trunk/KDE/kdeutils/kgpg/core/KGpgKeyNode.h #1166619:1166620
@@ -52,7 +52,7 @@
 	typedef QList<KGpgKeyNode *> List;
 	typedef QList<const KGpgKeyNode *> ConstList;
 
-	explicit KGpgKeyNode(KGpgExpandableNode *parent, const KgpgCore::KgpgKey &k);
+	explicit KGpgKeyNode(KGpgRootNode *parent, const KgpgCore::KgpgKey &k);
 	virtual ~KGpgKeyNode();
 
 	virtual bool hasChildren() const;
--- trunk/KDE/kdeutils/kgpg/core/KGpgRefNode.cpp #1166619:1166620
@@ -103,10 +103,8 @@
 }
 
 void
-KGpgRefNode::unRef()
+KGpgRefNode::unRef(KGpgRootNode *root)
 {
-	KGpgRootNode *root = getRootNode();
-
 	if (root != NULL)
 		connect(root, SIGNAL(newKeyNode(KGpgKeyNode *)), this, SLOT(keyUpdated(KGpgKeyNode *)));
 
--- trunk/KDE/kdeutils/kgpg/core/KGpgRefNode.h #1166619:1166620
@@ -78,10 +78,18 @@
 
 	/**
 	 * Break the current reference
+	 * @param root root node
 	 *
 	 * This is called when the referenced node is going away.
+	 *
+	 * The root node is passed for two reasons:
+	 * @li it doesn't need to be searched again for every ref node which
+	 * can be many in case of an important key node get's deleted
+	 * @li the ref node may be a child of the deleted node, then we can
+	 * not call the parents functions to find the root anymore. This helps
+	 * simplifying the code
 	 */
-	void unRef();
+	void unRef(KGpgRootNode *root);
 
 private Q_SLOTS:
 	void keyUpdated(KGpgKeyNode *);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic