Bug 147919

Summary: crash when changing the attribute name
Product: [Applications] umbrello Reporter: Anton Pussep <anton>
Component: generalAssignee: Oliver Kellogg <okellogg>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: class diagram that shows the described behaviour
KDE Crash Handler Backtrace file

Description Anton Pussep 2007-07-16 15:16:30 UTC
Version:           1.5.71 (using KDE KDE 3.5.5)
Installed from:    Debian stable Packages
OS:                Linux

When I change the name of the attribute pcDescriptionReader of the class PCDescriptionManagerFactory (see attached xmi file) the application crashes. There is also a KDE Crash Handler Backtrace file that I am attaching to this thread.
Comment 1 Anton Pussep 2007-07-16 15:17:05 UTC
Created attachment 21162 [details]
class diagram that shows the described behaviour
Comment 2 Anton Pussep 2007-07-16 15:17:47 UTC
Created attachment 21163 [details]
KDE Crash Handler Backtrace file
Comment 3 Bram Schoenmakers 2007-07-16 18:44:31 UTC
Please do not paste backtraces, but paste them here. That makes things easier for bug hunters.

(no debugging symbols found)
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1234626880 (LWP 5260)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
0xb675003b in nanosleep () from /lib/tls/libc.so.6
#0  0xb675003b in nanosleep () from /lib/tls/libc.so.6
#1  0xb674fe8e in sleep () from /lib/tls/libc.so.6
#2  0xb7544ac0 in KCrash::startDrKonqi () from /usr/lib/libkdecore.so.4
#3  0xb755a523 in KCrash::defaultCrashHandler () from /usr/lib/libkdecore.so.4
#4  0xffffe420 in ?? ()
#5  0x0000000b in ?? ()
#6  0x00000033 in ?? ()
#7  0xc0100000 in ?? ()
#8  0xc010007b in ?? ()
#9  0xffff007b in ?? ()
#10 0xffffffff in ?? ()
#11 0xffffffff in ?? ()
#12 0xbf8c15a8 in ?? ()
#13 0xbf8c15a8 in ?? ()
#14 0x000f005a in ?? ()
#15 0x00000002 in ?? ()
#16 0x000002bf in ?? ()
#17 0x000f005a in ?? ()
#18 0x0000000e in ?? ()
#19 0x00000004 in ?? ()
#20 0xb7103466 in QCanvasRectangle::width () from /usr/lib/libqt-mt.so.3
#21 0x081127c1 in AssociationWidget::calculateTextPosition ()
#22 0x08117d22 in AssociationWidget::saveIdealTextPositions ()
#23 0x081f6006 in UMLWidget::adjustAssocs ()
#24 0x0812a250 in ClassifierWidget::adjustAssocs ()
#25 0x081f6426 in UMLWidget::updateWidget ()
#26 0x081f67b7 in UMLWidget::qt_invoke ()
#27 0xb6ed5e7c in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#28 0xb6ed67e0 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#29 0x081d443d in UMLObject::modified ()
#30 0x081d4464 in UMLObject::qt_emit ()
#31 0x081a7759 in UMLCanvasObject::qt_emit ()
#32 0x0818616f in UMLPackage::qt_emit ()
#33 0x0811fd70 in UMLClassifier::qt_emit ()
#34 0xb6ed5e50 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#35 0xb6ed67e0 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#36 0x081d443d in UMLObject::modified ()
#37 0x0829b772 in UMLAttributeDialog::apply ()
#38 0x0829bdb2 in UMLAttributeDialog::slotOk ()
#39 0xb78ecde9 in KDialogBase::qt_invoke () from /usr/lib/libkdeui.so.4
#40 0x0829b233 in UMLAttributeDialog::qt_invoke ()
#41 0xb6ed5d4f in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#42 0xb6ed67e0 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#43 0xb7267f33 in QButton::clicked () from /usr/lib/libqt-mt.so.3
#44 0xb6f72cf6 in QButton::mouseReleaseEvent () from /usr/lib/libqt-mt.so.3
#45 0xb6f0c6f0 in QWidget::event () from /usr/lib/libqt-mt.so.3
#46 0xb6e6dc26 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#47 0xb6e6fdc9 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#48 0xb7633e0e in KApplication::notify () from /usr/lib/libkdecore.so.4
#49 0xb6e01495 in QApplication::sendSpontaneousEvent ()
   from /usr/lib/libqt-mt.so.3
#50 0xb6e0012f in QETWidget::translateMouseEvent ()
   from /usr/lib/libqt-mt.so.3
#51 0xb6dfe6b0 in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#52 0xb6e14d02 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#53 0xb6e88179 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#54 0xb6e6f73d in QApplication::enter_loop () from /usr/lib/libqt-mt.so.3
#55 0xb7089181 in QDialog::exec () from /usr/lib/libqt-mt.so.3
#56 0x0811c593 in UMLAttribute::showPropertiesDialog ()
#57 0x082bc40b in ClassifierListPage::slotDoubleClick ()
#58 0x082be038 in ClassifierListPage::qt_invoke ()
#59 0xb6ed5d4f in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#60 0xb7273ece in QListBox::doubleClicked () from /usr/lib/libqt-mt.so.3
#61 0xb6fbf2cf in QListBox::mouseDoubleClickEvent ()
   from /usr/lib/libqt-mt.so.3
#62 0xb6f0c72f in QWidget::event () from /usr/lib/libqt-mt.so.3
#63 0xb6e6dc26 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#64 0xb6e6fdc9 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#65 0xb7633e0e in KApplication::notify () from /usr/lib/libkdecore.so.4
#66 0xb6e01495 in QApplication::sendSpontaneousEvent ()
   from /usr/lib/libqt-mt.so.3
#67 0xb6e0012f in QETWidget::translateMouseEvent ()
   from /usr/lib/libqt-mt.so.3
#68 0xb6dfe6b0 in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#69 0xb6e14d02 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#70 0xb6e88179 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#71 0xb6e6f73d in QApplication::enter_loop () from /usr/lib/libqt-mt.so.3
#72 0xb7089181 in QDialog::exec () from /usr/lib/libqt-mt.so.3
#73 0x081f56ce in UMLWidget::showProperties ()
#74 0x081f9b7b in UMLWidget::slotMenuSelection ()
#75 0x081973d4 in ToolBarStateArrow::mouseDoubleClickWidget ()
#76 0x08196faf in ToolBarState::mouseDoubleClick ()
#77 0xb7009d69 in QScrollView::viewportMouseDoubleClickEvent ()
   from /usr/lib/libqt-mt.so.3
#78 0xb700b418 in QScrollView::eventFilter () from /usr/lib/libqt-mt.so.3
#79 0xb6ed5302 in QObject::activate_filters () from /usr/lib/libqt-mt.so.3
#80 0xb6ed5380 in QObject::event () from /usr/lib/libqt-mt.so.3
#81 0xb6f0c612 in QWidget::event () from /usr/lib/libqt-mt.so.3
#82 0xb6e6dc26 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#83 0xb6e6fdc9 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#84 0xb7633e0e in KApplication::notify () from /usr/lib/libkdecore.so.4
#85 0xb6e01495 in QApplication::sendSpontaneousEvent ()
   from /usr/lib/libqt-mt.so.3
#86 0xb6e0012f in QETWidget::translateMouseEvent ()
   from /usr/lib/libqt-mt.so.3
#87 0xb6dfe6b0 in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#88 0xb6e14d02 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#89 0xb6e88179 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#90 0xb6e87f9a in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#91 0xb6e6f7bf in QApplication::exec () from /usr/lib/libqt-mt.so.3
#92 0x0816cdb7 in main ()
Comment 4 Oliver Kellogg 2007-07-16 20:12:43 UTC
> [...] That makes things easier for bug hunters.

Thanks. I just wish there _were_ more of them out there !
Comment 5 Oliver Kellogg 2007-07-16 23:00:22 UTC
SVN commit 688793 by okellogg:

UMLObject::set{Name,Visibility}: Make virtual.
UMLAttribute::attributeChanged(): New signal.
UMLAttribute::set{Name,Visibility}: New.  Reimplement methods from UMLObject
 in order to emit extra signal attributeChanged().
AssociationWidget::slotAttributeChanged(): New slot. Connects to UMLAttribute::
 attributeChanged() when the AssociationWidget represents an UMLAttribute.

The extra signal is necessary because the attribute name must already have
been updated at the AssociationWidget by the time UMLObject::emitModified()
is called else UMLView::createAutoAttributeAssociations() will think it needs
to create a new attribute association.

BUG:147919


 M  +1 -0      ChangeLog  
 M  +14 -0     umbrello/associationwidget.cpp  
 M  +8 -0      umbrello/associationwidget.h  
 M  +13 -1     umbrello/attribute.cpp  
 M  +20 -0     umbrello/attribute.h  
 M  +2 -2      umbrello/umlobject.h  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #688792:688793
@@ -8,6 +8,7 @@
 * The size of a fork/join is not restored (147069)
 * Crash when changing the association type to containment (147202)
 * Moving component on diagram results in absurd shape of self-association (147810)
+* Crash when changing the attribute name (147919)
 
 Version 1.5.71
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #688792:688793
@@ -3110,6 +3110,7 @@
     if (obj == NULL)
         return;
     UMLClassifier *klass = NULL;
+    UMLAttribute *attr = NULL;
     UMLEntity *ent = NULL;
     const Uml::Object_Type ot = obj->getBaseType();
     switch (ot) {
@@ -3123,6 +3124,8 @@
             klass = static_cast<UMLClassifier*>(obj->parent());
             connect(klass, SIGNAL(attributeRemoved(UMLClassifierListItem*)),
                     this, SLOT(slotAttributeRemoved(UMLClassifierListItem*)));
+            attr = static_cast<UMLAttribute*>(obj);
+            connect(attr, SIGNAL(attributeChanged()), this, SLOT(slotAttributeChanged()));
             break;
         case Uml::ot_EntityAttribute:
             ent = static_cast<UMLEntity*>(obj->parent());
@@ -3143,6 +3146,17 @@
     m_pView->removeAssoc(this);
 }
 
+void AssociationWidget::slotAttributeChanged() {
+    UMLAttribute *attr = getAttribute();
+    if (attr == NULL) {
+        kError() << "AssociationWidget::slotAttributeChanged: getAttribute returns NULL"
+            << endl;
+        return;
+    }
+    setVisibility(attr->getVisibility(), B);
+    setRoleName(attr->getName(), B);
+}
+
 void AssociationWidget::init (UMLView *view)
 {
     WidgetBase::init(view, wt_Association);
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.h #688792:688793
@@ -1030,6 +1030,14 @@
     void slotAttributeRemoved(UMLClassifierListItem* obj);
 
     /**
+     * Connected to UMLObject::modified() in case this
+     * AssociationWidget is linked to a classifer's attribute type.
+     *
+     * @param obj               The UMLAttribute removed.
+     */
+    void slotAttributeChanged();
+
+    /**
      * Synchronize this widget from the UMLAssociation.
      */
     void syncToModel();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/attribute.cpp #688792:688793
@@ -48,6 +48,18 @@
 
 UMLAttribute::~UMLAttribute() { }
 
+void UMLAttribute::setName(const QString &name) {
+    m_Name = name;
+    emit attributeChanged();
+    UMLObject::emitModified();
+}
+
+void UMLAttribute::setVisibility(Uml::Visibility s) {
+    m_Vis = s;
+    emit attributeChanged();
+    UMLObject::emitModified();
+}
+
 QString UMLAttribute::getInitialValue() {
     return m_InitialValue;
 }
@@ -312,4 +324,4 @@
 }
 
 
-
+#include "attribute.moc"
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/attribute.h #688792:688793
@@ -26,6 +26,7 @@
  * Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
  */
 class UMLAttribute : public UMLClassifierListItem {
+    Q_OBJECT
 public:
     /**
      * Sets up an attribute.
@@ -66,6 +67,18 @@
     virtual void copyInto(UMLAttribute *rhs) const;
 
     /**
+     * Reimplementation of method from UMLObject is required as
+     * an extra signal, attributeChanged(), is emitted.
+     */
+    void setName(const QString &name);
+
+    /**
+     * Reimplementation of method from UMLObject is required as
+     * an extra signal, attributeChanged(), is emitted.
+     */
+    void setVisibility(Uml::Visibility s);
+
+    /**
      * Make a clone of the UMLAttribute.
      */
     virtual UMLObject* clone() const;
@@ -117,6 +130,13 @@
      */
     virtual UMLClassifierList getTemplateParams();
 
+signals:
+    /**
+     * Required for informing AssociationWidgets representing this attribute
+     * that the attribute name or visibility has changed.
+     */
+    void attributeChanged();
+
 protected:
     /**
      * Loads the <UML:Attribute> XMI element.
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.h #688792:688793
@@ -131,7 +131,7 @@
      *
      * @param s The visibility of the object.
      */
-    void setVisibility(Uml::Visibility s);
+    virtual void setVisibility(Uml::Visibility s);
 
     /**
      * Sets the classes stereotype name.
@@ -229,7 +229,7 @@
     /**
      * Set the UMLObject's name
      */
-    void setName(const QString &strName);
+    virtual void setName(const QString &strName);
 
     /**
      * Returns the fully qualified name, i.e. all package prefixes and then m_Name.