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

Oliver Kellogg okellogg at users.sourceforge.net
Sat Apr 7 17:14:43 UTC 2007


SVN commit 651424 by okellogg:

setAssocType(): Do not  physically delete the floatingtext widgets because
 they are also stored in the UMLView::m_WidgetList.
One round of applause to valgrind - I wonder how long it would have taken me
 to find this bug without it.
BUG:143909


 M  +1 -0      ChangeLog  
 M  +8 -10     umbrello/associationwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #651423:651424
@@ -33,6 +33,7 @@
 * Missing "with" on Ada code generation for aggregation (142392)
 * Operation Properties "Type" combo box too small (143319)
 * Support duplication of diagrams (143581)
+* Crash on changing multiplicity in an association in ERD (143909)
 
 Version 1.5.61
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #651423:651424
@@ -873,26 +873,24 @@
     m_AssocType = type;
     m_LinePath.setAssocType(type);
     // If the association new type is not supposed to have Multiplicity
-    // FloatingTexts and a Role FloatingTextWidget then set the internal
-    // floating text pointers to null.
+    // FloatingTexts and a Role FloatingTextWidget then set the texts
+    // to empty.
+    // NB We do not physically delete the floatingtext widgets here because
+    // those widgets are also stored in the UMLView::m_WidgetList.
     if( !AssocRules::allowMultiplicity(type, getWidget(A)->getBaseType()) ) {
         if (m_role[A].m_pMulti) {
-            delete m_role[A].m_pMulti;
-            m_role[A].m_pMulti = NULL;
+            m_role[A].m_pMulti->setName("");
         }
         if (m_role[B].m_pMulti) {
-            delete m_role[B].m_pMulti;
-            m_role[B].m_pMulti = NULL;
+            m_role[B].m_pMulti->setName("");
         }
     }
     if( !AssocRules::allowRole( type ) ) {
         if (m_role[A].m_pRole) {
-            delete m_role[A].m_pRole;
-            m_role[A].m_pRole = NULL;
+            m_role[A].m_pRole->setName("");
         }
         if (m_role[B].m_pRole) {
-            delete m_role[B].m_pRole;
-            m_role[B].m_pRole = NULL;
+            m_role[B].m_pRole->setName("");
         }
         setRoleDoc("", A);
         setRoleDoc("", B);




More information about the umbrello-devel mailing list