Bug 143909 - crash: umbrello crashes if you change multiplicity in an association in ERD
Summary: crash: umbrello crashes if you change multiplicity in an association in ERD
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-06 20:19 UTC by Haeber
Modified: 2007-04-08 15:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Haeber 2007-04-06 20:19:00 UTC
Version:           1.5.7 (using KDE 3.5.6 "release 64.1" , openSUSE )
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.18.8-0.1-default

Create an entity relations diagram, create two entities, connect both with an association. Then type a multipility on noth sides into the association. If you change this mutliplicity with other values umbrello crashes.

Tested with umbrello developer version of 1.5.7 from today.

Best regards
Thomas
Comment 1 Haeber 2007-04-06 20:20:30 UTC
the debug output:

umbrello: WorkToolBar::loadPixmaps: n_buttonInfos = 43
umbrello: UMLListViewItem::init: s_pListView still NULL, setting it now
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: ERROR: UMLApp::setCurrentView: m_viewStack is NULL
umbrello: Object_Factory::createUMLObject(): parentPkg is not set, assuming Model_Type 4
umbrello: Object_Factory::createUMLObject(): parentPkg is not set, assuming Model_Type 4
umbrello: UMLView::addWidget (n type=313): position (0,0) is out of range
umbrello: UMLView::addWidget (m type=313): position (0,0) is out of range
umbrello: ERROR: UMLView::addWidget: Not adding (id=Q7Uttd4nvsyJ/type=313/name=n) because it's already there
umbrello: ERROR: UMLView::addWidget: Not adding (id=wifJSPxTCyqO/type=313/name=m) because it's already there
KCrash: Application 'umbrello' crashing...
Comment 2 Oliver Kellogg 2007-04-07 04:03:39 UTC
Only happens when using the Association Properties menu, i.e. does not
happen when selecting "Change Multiplicity..." after right clicking on the multiplicity label.

Backtrace:

#4  0x416affcc in memcpy () from /lib/tls/libc.so.6
#5  0x415eb313 in std::string::_Rep::_M_clone () from /usr/lib/libstdc++.so.5
#6  0x415eb5b7 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string () from /usr/lib/libstdc++.so.5
#7  0x081f6bee in UMLWidget::getID (this=0x8a15a40)
    at umlwidget.cpp:184
#8  0x081e4b78 in UMLView::findWidget (this=0x8ae5ef8, id=
        {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<No data fields>}, _M_p = 0x8c42984 "0XWNnqkCkggZ"}, static 
_S_empty_rep_storage = {0, 0, 0, 0}})
    at umlview.cpp:733
#9  0x081e74a2 in UMLView::addWidget (this=0x8ae5ef8, pWidget=0x8933448, 
    isPasteOperation=false)
    at umlview.cpp:1447
#10 0x0812e434 in AssociationWidget::setMulti (this=0x8be2950, 
    strMulti=@0xbfffd250, role=A)
    at /home/kellogg/kdesdk-3.5-branch/umbrello/umbrello/associationwidget.cpp:369
#11 0x08279fd4 in AssocRolePage::updateObject (this=0x8b9cc88)
    at dialogs/assocrolepage.cpp:248
#12 0x08277c57 in AssocPropDlg::slotApply (this=0xbfffdef0)
    at /home/kellogg/kdesdk-3.5-branch/umbrello/umbrello/dialogs/assocpropdlg.cpp:69
#13 0x08277be9 in AssocPropDlg::slotOk (this=0xbfffdef0)
    at dialogs/assocpropdlg.cpp:58
#14 0x40826ac0 in KDialogBase::qt_invoke () from /opt/kde3/lib/libkdeui.so.4
#15 0x082782b1 in AssocPropDlg::qt_invoke (this=0xbfffdef0, _id=74, 
    _o=0xbfffd390)
    at dialogs/assocpropdlg.moc:87
#16 0x40e6415e in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#17 0x40e64906 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#18 0x411bf51c in QButton::clicked () from /usr/lib/qt3/lib/libqt-mt.so.3
#19 0x40efca04 in QButton::mouseReleaseEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#20 0x40e9a6c5 in QWidget::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#21 0x40e00faf in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#22 0x40e034b6 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#23 0x40a8c6b1 in KApplication::notify () from /opt/kde3/lib/libkdecore.so.4
#24 0x40d9e28e in QETWidget::translateMouseEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#25 0x40d9d146 in QApplication::x11ProcessEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#26 0x40dadc38 in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#27 0x40e190a1 in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#28 0x40e02b0f in QApplication::enter_loop ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#29 0x40ffae12 in QDialog::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#30 0x081350c3 in AssociationWidget::showDialog (this=0x8be2950)
    at associationwidget.cpp:2281
#31 0x081355f6 in AssociationWidget::slotMenuSelection (this=0x8be2950, sel=85)
    at associationwidget.cpp:2332
Comment 3 Oliver Kellogg 2007-04-07 19:14:46 UTC
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);
Comment 4 Oliver Kellogg 2007-04-07 19:57:04 UTC
SVN commit 651441 by okellogg:

m_AssocRules: Allow multiplicity on the relationship association between two entities.
In ER modeling, there exists the so-called "cardinality" which could roughly be equated
to UML multiplicity, see e.g.
http://www.dama-michigan.org/2 Jerry Stembridge Feature Article.htm

With this change, the multplicity-zeroing logic in AssociationwWidget::setAssocType()
does not take effect in the first place.
CCBUG:143909


 M  +3 -2      assocrules.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/assocrules.cpp #651440:651441
@@ -274,7 +274,8 @@
 }
 
 AssocRules::Assoc_Rule AssocRules::m_AssocRules []= {
-    //  Association     widgetA         widgetB         role    multiplicity    directional     self
+    //  Association     widgetA         widgetB         role    multi   directional  self
+    //---------------+----------------+----------------+-------+-------+-------+---------
     { at_Association_Self,wt_Class,     wt_Class,       true,   true,   true,   true  },
     { at_Association_Self,wt_Object,    wt_Object,      true,   true,   true,   true  },
     { at_Association_Self,wt_Interface, wt_Interface,   true,   true,   true,   true  },
@@ -373,7 +374,7 @@
     { at_Anchor,        wt_Message,     wt_Note,        false,  false,  false,  false },
     { at_Anchor,        wt_State,       wt_Note,        false,  false,  false,  false },
     { at_Anchor,        wt_Activity,    wt_Note,        false,  false,  false,  false },
-    { at_Relationship,  wt_Entity,      wt_Entity,      true,   false,  true,   false },
+    { at_Relationship,  wt_Entity,      wt_Entity,      true,   true,   true,   true  },
 };
 
 int AssocRules::m_nNumRules = sizeof( m_AssocRules ) / sizeof( AssocRules::Assoc_Rule );
Comment 5 Haeber 2007-04-08 15:13:06 UTC
Thanks for this really fast bugfix. It works flawlessly.

Best regards
Thomas