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

Oliver Kellogg okellogg at users.sourceforge.net
Thu Oct 26 19:10:12 UTC 2006


SVN commit 599346 by okellogg:

UMLCanvasObject::removeAllChildObjects(): New.

 M  +1 -1      package.cpp  
 M  +8 -1      umlcanvasobject.cpp  
 M  +2 -0      umlcanvasobject.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/package.cpp #599345:599346
@@ -87,7 +87,7 @@
 }
 
 void UMLPackage::removeAllObjects() {
-    UMLCanvasObject::removeAllAssociations();
+    UMLCanvasObject::removeAllChildObjects();
     UMLObject *o;
     for (UMLObjectListIt oit(m_objects); (o = oit.current()) != NULL; ++oit) {
         UMLPackage *pkg = dynamic_cast<UMLPackage*>(o);
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlcanvasobject.cpp #599345:599346
@@ -125,10 +125,17 @@
             kdDebug() << "UMLCanvasObject::removeAllAssociations(" << m_Name
                 << "): objB is NULL" << endl;
         m_List.remove(assoc);
-        //delete assoc;  should not do this here, we are only a CLIENT of the assoc
+        //delete assoc;  //CHECK: Apparently we crash if doing this. WHY?
     }
 }
 
+void UMLCanvasObject::removeAllChildObjects() {
+    removeAllAssociations();
+    m_List.setAutoDelete(true);
+    m_List.clear();
+    m_List.setAutoDelete(false);
+}
+
 QString UMLCanvasObject::uniqChildName( const Uml::Object_Type type,
                                         bool seekStereo /* = false */ ) {
     QString currentName;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlcanvasobject.h #599345:599346
@@ -188,6 +188,8 @@
     virtual QString uniqChildName(const Uml::Object_Type type,
                                   bool seekStereo = false);
 
+    virtual void removeAllChildObjects();
+
     /**
      * Return the list of subordinate items.
      */




More information about the umbrello-devel mailing list