Bug 72016 - crash when deleteing an attribute/operation etc
Summary: crash when deleteing an attribute/operation etc
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: HI crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-07 00:08 UTC by Jonathan Riddell
Modified: 2005-07-29 07:49 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 Jonathan Riddell 2004-01-07 00:08:40 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Umbrello crashes when deleteing an attribute or operation from a class with this very long backtrace:

#0  0x4122978d in __dynamic_cast () from /usr/lib/libstdc++.so.5
#1  0x0813c0f8 in OwnedCodeBlock::setAttributesOnNode(QDomDocument&, QDomElement&) (this=0x848fa0c, elem=@0xbfffdbe0)
    at ownedcodeblock.cpp:89
#2  0x0810cbb5 in CodeMethodBlock::setAttributesOnNode(QDomDocument&, QDomElement&) (this=0x848f9e8, doc=@0xbfffe150,
    elem=@0xbfffdbe0) at codemethodblock.cpp:89
#3  0x080fba95 in CodeAccessorMethod::setAttributesOnNode(QDomDocument&, QDomElement&) (this=0x848f9e8, doc=@0xbfffda60,
    elem=@0xbfffdbe0) at codeaccessormethod.cpp:123
#4  0x080fba36 in CodeAccessorMethod::saveToXMI(QDomDocument&, QDomElement&) (this=0x848f9e8, doc=@0xbfffe150,
    root=@0xbfffdc40) at codeaccessormethod.cpp:109
#5  0x0810b930 in CodeGenObjectWithTextBlocks::setAttributesOnNode(QDomDocument&, QDomElement&) (this=0xbfffda60,
    doc=@0xbfffe150, root=@0xbfffdd20) at codegenobjectwithtextblocks.cpp:368
#6  0x0811bbf5 in HierarchicalCodeBlock::setAttributesOnNode(QDomDocument&, QDomElement&) (this=0x842c818,
    doc=@0xbfffe150, elem=@0xbfffdd20) at hierarchicalcodeblock.cpp:285
#7  0x0811bb86 in HierarchicalCodeBlock::saveToXMI(QDomDocument&, QDomElement&) (this=0x842c818, doc=@0xbfffe150,
    root=@0xbfffdd80) at hierarchicalcodeblock.cpp:274
#8  0x0810b930 in CodeGenObjectWithTextBlocks::setAttributesOnNode(QDomDocument&, QDomElement&) (this=0xbfffda60,
    doc=@0xbfffe150, root=@0xbfffdec0) at codegenobjectwithtextblocks.cpp:368
#9  0x0810274b in CodeDocument::setAttributesOnNode(QDomDocument&, QDomElement&) (this=0x8424ca8, doc=@0xbfffe150,
    docElement=@0xbfffdec0) at codedocument.cpp:375
#10 0x080f4cb8 in ClassifierCodeDocument::setAttributesOnNode(QDomDocument&, QDomElement&) (this=0x8424ca8,
    doc=@0xbfffe150, docElement=@0xbfffdec0) at classifiercodedocument.cpp:624
#11 0x080f4c39 in ClassifierCodeDocument::saveToXMI(QDomDocument&, QDomElement&) (this=0x8424ca8, doc=@0xbfffe150,
    root=@0xbfffdf30) at classifiercodedocument.cpp:598
#12 0x08254483 in CPPCodeGenerator::saveToXMI(QDomDocument&, QDomElement&) (this=0x84361a8, doc=@0xbfffe150,
    root=@0xbfffdfe0) at cppcodegenerator.cpp:183
#13 0x0815bc43 in UMLDoc::saveToXMI(QIODevice&) (this=0x83e82c0, file=@0x8429358) at qdict.h:111
#14 0x08160b8c in UMLDoc::addToUndoStack() (this=0x83e82c0) at umldoc.cpp:2280
#15 0x0815f6d9 in UMLDoc::setModified(bool, bool) (this=0x83e82c0, modified=true, addToUndo=true) at umldoc.cpp:2013
#16 0x0815a5f5 in UMLDoc::removeUMLObject(UMLObject*) (this=0x83e82c0, umlobject=0x84c2ae0) at umldoc.cpp:1261
#17 0x0822bc07 in ClassifierListPage::slotDelete() (this=0x848a9f8) at classifierlistpage.cpp:366
#18 0x0822c0cf in ClassifierListPage::qt_invoke(int, QUObject*) (this=0x848a9f8, _id=55, _o=0xbfffe2e0)
    at classifierlistpage.moc:149
#19 0x40bcf8bc in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/lib/libqt-mt.so.3
#20 0x40bcf6f4 in QObject::activate_signal(int) () from /usr/lib/libqt-mt.so.3
#21 0x40ef320e in QButton::clicked() () from /usr/lib/libqt-mt.so.3
#22 0x40c5e14a in QButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libqt-mt.so.3
#23 0x40c04917 in QWidget::event(QEvent*) () from /usr/lib/libqt-mt.so.3
#24 0x40b742df in QApplication::internalNotify(QObject*, QEvent*) () from /usr/lib/libqt-mt.so.3
#25 0x40b739e1 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libqt-mt.so.3
#26 0x4076f0dd in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdecore.so.4
#27 0x40b0d148 in QETWidget::translateMouseEvent(_XEvent const*) () from /usr/lib/libqt-mt.so.3
#28 0x40b0aa5e in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libqt-mt.so.3
#29 0x40b20d91 in QEventLoop::processEvents(unsigned) () from /usr/lib/libqt-mt.so.3
#30 0x40b87ac8 in QEventLoop::enterLoop() () from /usr/lib/libqt-mt.so.3
#31 0x40b74591 in QApplication::enter_loop() () from /usr/lib/libqt-mt.so.3
#32 0x40d4f830 in QDialog::exec() () from /usr/lib/libqt-mt.so.3
#33 0x0815f608 in UMLDoc::showProperties(UMLWidget*) (this=0x83e82c0, o=0x8561090) at umldoc.cpp:1998
---Type <return> to continue, or q <return> to quit---
#34 0x0818470c in UMLWidget::slotMenuSelection(int) (this=0x8561090, sel=1970) at umlwidget.cpp:473
#35 0x08184b7b in UMLWidget::mouseDoubleClickEvent(QMouseEvent*) (this=0x8561090, me=0xbfffda60) at umlwidget.cpp:592
#36 0x0817c5fe in UMLView::allocateMouseDoubleClickEvent(QMouseEvent*) (this=0x8419870, me=0x8408d80) at umlview.cpp:2362
#37 0x08177047 in UMLView::contentsMouseDoubleClickEvent(QMouseEvent*) (this=0x8419870, ome=0xbfffedbc) at umlview.cpp:921
#38 0x40cde3dc in QScrollView::viewportMouseDoubleClickEvent(QMouseEvent*) () from /usr/lib/libqt-mt.so.3
#39 0x40cddc1a in QScrollView::eventFilter(QObject*, QEvent*) () from /usr/lib/libqt-mt.so.3
#40 0x40bcd44e in QObject::activate_filters(QEvent*) () from /usr/lib/libqt-mt.so.3
#41 0x40bcd37c in QObject::event(QEvent*) () from /usr/lib/libqt-mt.so.3
#42 0x40c0488f in QWidget::event(QEvent*) () from /usr/lib/libqt-mt.so.3
#43 0x40b742df in QApplication::internalNotify(QObject*, QEvent*) () from /usr/lib/libqt-mt.so.3
#44 0x40b739e1 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libqt-mt.so.3
#45 0x4076f0dd in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdecore.so.4
#46 0x40b0d148 in QETWidget::translateMouseEvent(_XEvent const*) () from /usr/lib/libqt-mt.so.3
#47 0x40b0aa5e in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libqt-mt.so.3
#48 0x40b20d91 in QEventLoop::processEvents(unsigned) () from /usr/lib/libqt-mt.so.3
#49 0x40b87ac8 in QEventLoop::enterLoop() () from /usr/lib/libqt-mt.so.3
#50 0x40b87978 in QEventLoop::exec() () from /usr/lib/libqt-mt.so.3
#51 0x40b74531 in QApplication::exec() () from /usr/lib/libqt-mt.so.3
#52 0x0813273e in main (argc=-1073751456, argv=0xbfffda60) at main.cpp:86
Comment 1 Brian Thomas 2004-02-17 19:30:44 UTC
I believe this is now fixed, it was related to both bugs in the slot/signal
connection code in the code generation as well as bad initialization of 
operations. If it isnt fixed, please pass along an XMI file which shows the
bug.
Comment 2 David Cuadrado 2005-06-06 23:45:24 UTC
umbrello crashes when the class is connected(class diagram) to others and I remove the attributes (my uml proyect have c++/kde imported code)

I use svn version
Comment 3 David Cuadrado 2005-06-07 00:10:35 UTC
I fix this temporaly

I don't know what problem can cause this fix

In associationwidget.cpp 
function: saveToXMI

diff:
3139a3140
>       m_pObject = 0;
Comment 4 Oliver Kellogg 2005-06-07 20:54:35 UTC
> umbrello crashes when the class is connected(class diagram) to others
> and I remove the attributes

Please post the backtrace, the necessary file(s) (XMI and/or C++
imported headers) and step-by-step instructions on how to produce
the problem.

> I fix this temporaly 
> [...]
> In associationwidget.cpp 
> function: saveToXMI 
 
Hmm well that's not really the Right Fix (TM)
Comment 5 Oliver Kellogg 2005-06-08 18:53:46 UTC
Found the problem anyway, fix is forthcoming
Comment 6 Oliver Kellogg 2005-06-08 23:13:35 UTC
SVN commit 423555 by okellogg:

setUMLObject(), slotAttributeRemoved(): New.
Cater to proper suicide if the underlying UMLAttribute is removed.
BUG:72016


 M  +13 -0     associationwidget.cpp  
 M  +15 -0     associationwidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.cpp #423554:423555
@@ -2987,7 +2987,20 @@
 	return rectangle;
 }
 
+void AssociationWidget::setUMLObject(UMLObject *obj) {
+	WidgetBase::setUMLObject(obj);
+	if (obj && obj->getBaseType() == Uml::ot_Attribute) {
+		UMLClassifier *klass = static_cast<UMLClassifier*>(obj->parent());
+		connect(klass, SIGNAL(attributeRemoved(UMLObject*)),
+			this, SLOT(slotAttributeRemoved(UMLObject*)));
+	}
+}
 
+void AssociationWidget::slotAttributeRemoved(UMLObject* obj) {
+	kdDebug() << "AssociationWidget::slotAttributeRemoved(" << obj->getName() << ")" << endl;
+	m_pView->removeAssoc(this);
+}
+
 void AssociationWidget::init (UMLView *view)
 {
 	m_pView = view;  // pointer to parent viewwidget object
--- trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.h #423554:423555
@@ -560,6 +560,13 @@
 	void computeAssocClassLine();
 
 	/**
+	 * Overriding the method from WidgetBase because we need to do
+	 * something extra in case this AssociationWidget represents
+	 * an attribute of a classifier.
+	 */
+	void setUMLObject(UMLObject *obj);
+
+	/**
 	 * Saves this widget to the <assocwidget> XMI element.
 	 */
 	void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
@@ -924,6 +931,14 @@
 	void slotClearAllSelected();
 
 	/**
+	 * Connected to UMLClassifier::attributeRemoved() in case this
+	 * AssociationWidget is linked to a classifer's attribute type.
+	 *
+	 * @param obj		The UMLAttribute removed.
+	 */
+	void slotAttributeRemoved(UMLObject* obj);
+
+	/**
 	 * Synchronize this widget from the UMLAssociation.
 	 */
 	void syncToModel();
Comment 7 Oliver Kellogg 2005-07-29 07:49:52 UTC
SVN commit 439865 by okellogg:

CCBUG:72016 - It turns out that the bug was not completely fixed;
the reoccurrence is fixed by the change below.
Unfortunately this checkin did not make it into version 1.4.2.

SVN commit 439023 by okellogg:

Backport commit #439013 from trunk:
> loadFromXMI(): use setUMLObject() so that the attributeRemoved signal gets connected.



 M  +1 -1      associationwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #439022:439023
@@ -3323,7 +3323,7 @@
         } else {
             const Uml::Object_Type ot = myObj->getBaseType();
             if (ot == ot_Attribute || ot == ot_Operation) {
-                m_pObject = myObj;
+                setUMLObject(myObj);
                 QString type = qElement.attribute( "type", "-1" );
                 Uml::Association_Type aType = (Uml::Association_Type) type.toInt();
                 setAssocType(aType);



 M  +2 -2      ChangeLog  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #439864:439865
@@ -6,12 +6,12 @@
 * Change interface into class and vice versa (if abstract and no attributes)
 
 * Bugs fixed / wishes implemented (see http://bugs.kde.org)
-57588 67719 79433 87252 88117 97162 105564 108223 109591
+57588 67719 72016 79433 87252 88117 97162 105564 108223 109591
 
 Version 1.4.2 (maintenance release)
 
 * Bugs fixed from http://bugs.kde.org :
-72016 97188 103170 106183 106356 106632 106673 107101 107551 108688
+97188 103170 106183 106356 106632 106673 107101 107551 108688
 
 Version 1.4.1 (maintenance release)