[Uml-devel] [Bug 63897] New: Crash when trying to associate two classes in a collaboration diagram
David Faure
faure at kde.org
Mon Sep 8 21:52:10 UTC 2003
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=63897
Summary: Crash when trying to associate two classes in a
collaboration diagram
Product: umbrello
Version: unspecified
Platform: Compiled Sources
OS/Version: Linux
Status: NEW
Severity: crash
Priority: NOR
Component: general
AssignedTo: umbrello-devel at kde.org
ReportedBy: faure at kde.org
Version: (using KDE Devel)
Installed from: Compiled sources
OS: Linux
New collaboration diagram, put two classes into it, then try to create a message from one class to the other... crash.
#0 0x0812878b in FloatingText::getText() const (this=0x0) at /mnt/devel/kde/kdecvs/kdesdk/umbrello/umbrello/floatingtext.cpp:406
406 if(m_Role == tr_Seq_Message || m_Role == tr_Seq_Message_Self ||
(gdb) up
#1 0x08139816 in AssociationWidget (this=0x8409988, parent=0x83ec1d0, WidgetA=0x8430bd0, Type=at_Coll_Message, WidgetB=0x8430d80)
at /mnt/devel/kde/kdecvs/kdesdk/umbrello/umbrello/associationwidget.cpp:70
70 setName( dynamic_cast<FloatingText*>(getNameWidget())->getText() );
(gdb) list
65 mergeAssociationDataIntoUMLRepresentation();
66
67 //collaboration messages need a name label because it's that
68 //which handles the right click menu options
69 if (getAssocType() == at_Coll_Message) {
70 setName( dynamic_cast<FloatingText*>(getNameWidget())->getText() );
71 m_pName->setUMLObject( m_pWidgetB->getUMLObject() );
72 }
73
74 }
Obviously getNameWidget() does not return a FloatingText.
Why use a dynamic_cast if you don't test the result for 0 ?
Either you know it's a FloatingText (well, obviously that's not the case here) and you can use static_cast, or you really test for it, and you have to test whether dynamic_cast returns 0.
Thanks for fixing.
More information about the umbrello-devel
mailing list