[Uml-devel] KDE_3_2_BRANCH: kdesdk/umbrello/umbrello

Jonathan Riddell jri at jriddell.org
Sat Feb 28 06:49:05 UTC 2004


CVS commit by jriddell: 

Backport ammendment to last fix from Feb 27
--
CVS commit by thomas:

As advised by Oliver, leave in a check for findAssociation in the
constructor to help debug whether or not changes will cause bugs in
other +parts of the association/uml code


  M +12 -7     associationwidget.cpp   1.80.2.5


--- kdesdk/umbrello/umbrello/associationwidget.cpp  #1.80.2.4:1.80.2.5
@@ -52,5 +52,5 @@ AssociationWidget::AssociationWidget(UML
                 UMLObject* umlRoleB = pWidgetB->getUMLObject();
                 if (umlRoleA != NULL && umlRoleB != NULL) {
-//                      bool swap;
+                        bool swap;
 
                         // THis isnt correct. We could very easily have more than one
@@ -58,10 +58,15 @@ AssociationWidget::AssociationWidget(UML
                         // Just create the association. This search should have been
                         // done BEFORE creation of the widget, if it mattered to the code.
-//                      UMLAssociation * myAssoc = umldoc->findAssociation( assocType, umlRoleA, umlRoleB, &swap );
-//                      if (myAssoc == NULL) {
+                        // But lets leave check in here for the time being so that debugging
+                        // output is shown, in case there is a collision with code elsewhere.
+                        UMLAssociation * testAssoc = umldoc->findAssociation( assocType, umlRoleA, umlRoleB, &swap );
+                        if (testAssoc != NULL) 
+                                kdWarning()<< " constructing a similar or exact same assoc " << 
+                                        "as an already exiting assoc!" << endl;
+
+                        // now, just create a new association anyways
                                 UMLAssociation * myAssoc = new UMLAssociation( umldoc, assocType, umlRoleA, umlRoleB );
-                                setUMLAssociation(myAssoc);
 /*
-                        } else if (swap) {
+                        else if (swap) {
                                 kdDebug() << "AssociationWidget(): umldoc->findAssoc returns swap true "
                                           << "for assoctype " << assocType << endl;
@@ -73,6 +78,6 @@ AssociationWidget::AssociationWidget(UML
                                 myAssoc = new UMLAssociation( umldoc, assocType, umlRoleA, umlRoleB );
                         }
-                        setUMLAssociation(myAssoc);
 */
+                        setUMLAssociation(myAssoc);
 /*
                         connect(m_pAssociation, SIGNAL(modified()), this,






More information about the umbrello-devel mailing list