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

Oliver Kellogg okellogg at users.sourceforge.net
Thu Oct 19 21:25:22 UTC 2006


SVN commit 597310 by okellogg:

removeObject(): Use UMLCanvasObject::removeAssociation() if the base type is
 ot_Association.
resolveRef(): Remove obj from m_objects if obj->resolveRef() fails.
CCBUG:135749


 M  +12 -3     package.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/package.cpp #597309:597310
@@ -76,7 +76,14 @@
 }
 
 void UMLPackage::removeObject(const UMLObject *pObject) {
-    m_objects.remove( pObject );
+    if (pObject->getBaseType() == Uml::ot_Association) {
+        UMLObject *o = const_cast<UMLObject*>(pObject);
+        UMLAssociation *assoc = static_cast<UMLAssociation*>(o);
+        UMLCanvasObject::removeAssociation(assoc);
+        delete assoc;
+    } else {
+        m_objects.remove(pObject);
+    }
 }
 
 void UMLPackage::removeAllObjects() {
@@ -86,7 +93,7 @@
         UMLPackage *pkg = dynamic_cast<UMLPackage*>(o);
         if (pkg)
             pkg->removeAllObjects();
-        //delete o;
+        delete o;
     }
     m_objects.clear();
 }
@@ -184,8 +191,10 @@
     bool overallSuccess = UMLCanvasObject::resolveRef();
     for (UMLObjectListIt oit(m_objects); oit.current(); ++oit) {
         UMLObject *obj = oit.current();
-        if (! obj->resolveRef())
+        if (! obj->resolveRef()) {
+            m_objects.remove(obj);
             overallSuccess = false;
+        }
     }
     return overallSuccess;
 }




More information about the umbrello-devel mailing list