Bug 63897 - Crash when trying to associate two classes in a collaboration diagram
Summary: Crash when trying to associate two classes in a collaboration diagram
Status: RESOLVED WORKSFORME
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-08 14:34 UTC by David Faure
Modified: 2003-10-06 01:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Faure 2003-09-08 14:34:24 UTC
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.
Comment 1 David Faure 2003-09-08 14:57:06 UTC
This appears to fix it, but then I can't change the label on the association !? 
 
--- associationwidget.cpp       7 Sep 2003 19:01:05 -0000       1.30 
+++ associationwidget.cpp       8 Sep 2003 12:56:17 -0000 
@@ -67,7 +67,7 @@ AssociationWidget::AssociationWidget(QWi 
        //collaboration messages need a name label because it's that 
        //which handles the right click menu options 
        if (getAssocType() == at_Coll_Message) { 
-               setName( dynamic_cast<FloatingText*>(getNameWidget())->getText() ); 
+               setName( QString::null ); 
                m_pName->setUMLObject( m_pWidgetB->getUMLObject() ); 
        } 
 
Comment 2 Oliver Kellogg 2003-09-09 06:35:58 UTC
Subject: Re: [Uml-devel]  Crash when trying to associate two classes
	 in a collaboration diagram

David Faure wrote:
> ------- Additional Comments From faure@kde.org  2003-09-08 14:57 -------
> This appears to fix it, but then I can't change the label on the association
>  !? 

I will look at this. Just give me a day or two.

Thanks for your patience

Oliver

Comment 3 Oliver Kellogg 2003-09-13 21:50:04 UTC
Fixed in CVS.
Please verify.
Comment 4 David Faure 2003-09-14 21:23:11 UTC
Subject: Re:  Crash when trying to associate two classes in a collaboration diagram

On Saturday 13 September 2003 21:50, you wrote:
> Fixed in CVS.
> Please verify.

No crash anymore, but after saving and reloading all the associations are gone...

Maybe related:
umbrello: ERROR: AssociationWidget::loadFromXMI(): cannot find widget for roleA id 87
umbrello: ERROR: AssociationWidget::loadFromXMI(): cannot find widget for roleA id 88
umbrello: ERROR: AssociationWidget::loadFromXMI(): cannot find widget for roleA id 86
umbrello: ERROR: AssociationWidget::loadFromXMI(): cannot find widget for roleA id 89

(Also, it still doesn't seem possible to put text on the associations (in the RMB
I only see "new operation / select operation", is that what's supposed to make up
the text on the arrows?)

PS: starting umbrello with a .xmi file on the command line doesn't work: the file
gets loaded but automatically cleared out.

Comment 5 Oliver Kellogg 2003-09-27 14:52:36 UTC
The textual input at the message is broken,
and to solve this cleanly we need a major
overhaul of the FloatingText class.

OTOH, I cannot reproduce the missing associations
with current CVS.

Could you please do the following:
1. Try again with current CVS.
2. If you continue to see problems, create an XMI
   file attachment to this bug so that others have
   a chance of reproducing it.

Thanks.
Comment 6 Oliver Kellogg 2003-10-06 01:31:41 UTC
The associations are okay.
Unless some hero pops up to save the day, the
FloatingText overhaul is not likely to happen
in time for KDE 3.2.