[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Wed Jan 12 16:16:13 UTC 2005
CVS commit by okellogg:
findUMLObject(): The current code import logic apparently may produce
containment cycles (i.e. a->getUMLPackage() == b and b->getUMLPackage() == a.)
Add logic to break this tie. TODO: This a fix at the symptom, not at the cause.
We should solve the problem with cycles in the code import.
M +12 -2 model_utils.cpp 1.18
--- kdesdk/umbrello/umbrello/model_utils.cpp #1.17:1.18
@@ -24,4 +24,5 @@
// app includes
#include "umlobject.h"
+#include "umlpackagelist.h"
#include "package.h"
#include "classifier.h"
@@ -114,9 +115,18 @@ UMLObject* findUMLObject(UMLObjectList i
pkg = dynamic_cast<UMLPackage*>(currentObj->parent());
} else {
- pkg = dynamic_cast<UMLPackage*>(currentObj);
- if (pkg == NULL)
+ //pkg = dynamic_cast<UMLPackage*>(currentObj);
+ //if (pkg == NULL)
pkg = currentObj->getUMLPackage();
}
+ // Remember packages that we've seen - for avoiding cycles.
+ UMLPackageList seenPkgs;
for (; pkg; pkg = currentObj->getUMLPackage()) {
+ if (seenPkgs.findRef(pkg) != -1) {
+ kdError() << "findUMLObject(" << name << "): "
+ << "breaking out of cycle involving "
+ << pkg->getName() << endl;
+ break;
+ }
+ seenPkgs.append(pkg);
UMLObjectList objectsInCurrentScope = pkg->containedObjects();
for (UMLObjectListIt oit(objectsInCurrentScope); oit.current(); ++oit) {
More information about the umbrello-devel
mailing list