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

List:       kde-commits
Subject:    kdepim/certmanager/lib/ui
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2004-09-27 20:12:34
Message-ID: 20040927201234.13ED59922 () office ! kde ! org
[Download RAW message or body]

CVS commit by mutz: 

From KDE_3_3_BRANCH: Fix double-delete bug (aegypten2 issue #240). This is not a \
complete solution, that would involve overriding e.g. takeItem(), too. But I'll leave \
that to Qt4, whose Model/View abstraction will take care of that in a complete way.


  M +18 -0     keylistview.cpp   1.25
  M +3 -0      keylistview.h   1.21


--- kdepim/certmanager/lib/ui/keylistview.cpp  #1.24:1.25
@@ -229,4 +229,17 @@ void Kleo::KeyListView::clear() {
 }
 
+void Kleo::KeyListView::deregisterItem( const KeyListViewItem * item ) {
+  if ( !item )
+    return;
+  std::map<QCString,KeyListViewItem*>::iterator it
+    = d->itemMap.find( item->key().subkey(0).fingerprint() );
+  if ( it == d->itemMap.end() )
+    return;
+  Q_ASSERT( it->second != item );
+  if ( it->second != item )
+    return;
+  d->itemMap.erase( it );
+}
+
 void Kleo::KeyListView::doHierarchicalInsert( const GpgME::Key & key ) {
   const QCString fpr = key.subkey(0).fingerprint();
@@ -366,4 +379,9 @@ Kleo::KeyListViewItem::KeyListViewItem( 
 }
 
+Kleo::KeyListViewItem::~KeyListViewItem() {
+  if ( KeyListView * lv = listView() )
+    lv->deregisterItem( this );
+}
+
 void Kleo::KeyListViewItem::setKey( const GpgME::Key & key ) {
   mKey = key;

--- kdepim/certmanager/lib/ui/keylistview.h  #1.20:1.21
@@ -53,4 +53,5 @@ namespace Kleo {
     KeyListViewItem( KeyListViewItem * parent, const GpgME::Key & key );
     KeyListViewItem( KeyListViewItem * parent, KeyListViewItem * after, const \
GpgME::Key & key ); +    ~KeyListViewItem();
 
     void setKey( const GpgME::Key & key );
@@ -180,4 +181,5 @@ namespace Kleo {
   class KeyListView : public KListView {
     Q_OBJECT
+    friend class KeyListViewItem;
   public:
     class ColumnStrategy;
@@ -237,4 +239,5 @@ namespace Kleo {
     void refillFingerprintDictionary();
     KeyListViewItem * parentFor( const QCString & ) const;
+    void deregisterItem( const KeyListViewItem * );
 
   private:


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

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