[Uml-devel] KDE/kdesdk/umbrello/umbrello

Andi Fischer andi.fischer at hispeed.ch
Mon Dec 26 23:31:48 UTC 2011


SVN commit 1270636 by fischer:

Deletion of list elements fixed.

 M  +6 -3      umllistview.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #1270635:1270636
@@ -1240,9 +1240,10 @@
     }
     for (int i=0; i < item->childCount(); i++) {
         UMLListViewItem* foundItem = recursiveSearchForView(item->childItem(i), type, id);
-        if (foundItem)
+        if (foundItem) {
             return foundItem;
     }
+    }
     uWarning() << "returning 0";
     DEBUG(DBG_SRC) << "but was looking for " << *item;
     return 0;
@@ -1340,8 +1341,9 @@
  */
 void UMLListView::clean()
 {
-    for (int i = 0; i < Uml::ModelType::N_MODELTYPES; ++i)
+    for (int i = 0; i < Uml::ModelType::N_MODELTYPES; ++i) {
         deleteChildrenOf(m_lv[i]);
+    }
     //deleteChildrenOf(m_datatypeFolder);
 }
 
@@ -3181,6 +3183,7 @@
 
 /**
  * Deletes all child-items of @p parent.
+ * Do it in reverse order, because of the index.
  */
 void UMLListView::deleteChildrenOf(UMLListViewItem* parent)
 {
@@ -3191,7 +3194,7 @@
         delete m_datatypeFolder;
         m_datatypeFolder = 0;
     }
-    for (int i=0; i < parent->childCount(); i++)
+    for (int i = parent->childCount() - 1; i >= 0; --i)
         parent->removeChild(parent->child(i));
 }
 




More information about the umbrello-devel mailing list