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

List:       kde-commits
Subject:    branches/KDE/3.4/kdebase/konqueror/listview
From:       Michael Brade <brade () kde ! org>
Date:       2005-05-18 14:53:11
Message-ID: 1116427991.930551.9648.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 415410 by brade:

Backporting fixes for a lot of crashes when deleting items with the treeview.
Fixed #105304, #102331.


 M  +11 -8     branches/KDE/3.4/kdebase/konqueror/listview/konq_treeviewwidget.cc  


--- branches/KDE/3.4/kdebase/konqueror/listview/konq_treeviewwidget.cc #415409:415410
@@ -80,7 +80,8 @@
     QStringList openDirList;
 
     QDictIterator<KonqListViewDir> it( m_dictSubDirs );
-    for (; it.current(); ++it ) {
+    for (; it.current(); ++it )
+    {
         if ( it.current()->isOpen() )
             openDirList.append( it.current()->url( -1 ) );
     }
@@ -142,21 +143,23 @@
    // its children will be deleted by Qt immediately!
 
    kdDebug(1202) << k_funcinfo << _url << endl;
-
-   QListViewItem *item = m_dictSubDirs[_url.url(-1)];
+   
+   KonqListViewDir *item = m_dictSubDirs[_url.url(-1)];
    if ( item )
    {
       // search all subdirs of _url (item)
       QDictIterator<KonqListViewDir> it( m_dictSubDirs );
-      for ( ; it.current(); ++it )
+      while ( it.current() )
       {
-         if ( !_url.equals( it.current()->item()->url(), true )
-              && _url.isParentOf( it.current()->item()->url() ) )
+         if ( !_url.equals( it.currentKey(), true )
+              && _url.isParentOf( it.currentKey() ) )
          {
-            m_dictSubDirs.remove( it.currentKey() );
             m_urlsToOpen.remove( it.currentKey() );
             m_urlsToReload.remove( it.currentKey() );
+            m_dictSubDirs.remove( it.currentKey() );  // do last, it changes it.currentKey()!!
          }
+         else
+            ++it;
       }
       
       // Remark: This code works only if we have exactly one tree which is the
@@ -278,7 +281,7 @@
     QString url = _fileItem->url().url(-1);
 
     // Check if this item is in m_dictSubDirs, and if yes, then remove it
-    slotClear( KURL( url ) );
+    slotClear( _fileItem->url() );
    
     m_dictSubDirs.remove( url );
     m_urlsToOpen.remove( url );
[prev in list] [next in list] [prev in thread] [next in thread] 

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