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

Oliver Kellogg okellogg at users.sourceforge.net
Sun May 6 20:19:26 UTC 2007


SVN commit 661855 by okellogg:

load(): Avoid duplicate creation of an object object that was already created
due to a forward declaration.  The fix for bug 145035 (r661210) was spoiling
the fix for bug 144119 (r653599).


 M  +19 -6     folder.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/folder.cpp #661854:661855
@@ -379,13 +379,26 @@
                 continue;
             }
         }
-        QString stereoID = tempElement.attribute("stereotype", "");
-        UMLObject *pObject = Object_Factory::makeObjectFromXMI(type, stereoID);
-        if (!pObject) {
-            kWarning() << "UMLFolder::load: "
-                << "Unknown type of umlobject to create: " << type << endl;
-            continue;
+        UMLObject *pObject = NULL;
+        // Avoid duplicate creation of forward declared object
+        QString idStr = tempElement.attribute("xmi.id", "");
+        if (!idStr.isEmpty()) {
+            Uml::IDType id = STR2ID(idStr);
+            pObject = umldoc->findObjectById(id);
+            if (pObject) {
+                kDebug() << "UMLFolder::load: object " << idStr
+                  << "already exists" << endl;
+            }
         }
+        if (pObject == NULL) {
+            QString stereoID = tempElement.attribute("stereotype", "");
+            pObject = Object_Factory::makeObjectFromXMI(type, stereoID);
+            if (!pObject) {
+                kWarning() << "UMLFolder::load: "
+                    << "Unknown type of umlobject to create: " << type << endl;
+                continue;
+            }
+        }
         pObject->setUMLPackage(this);
         if (!pObject->loadFromXMI(tempElement)) {
             removeObject(pObject);




More information about the umbrello-devel mailing list