Bug 96216 - Crash when reordering attributes
Summary: Crash when reordering attributes
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: 2005-01-03 14:59 UTC by Christoph Bartoschek
Modified: 2005-01-10 02:18 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 Christoph Bartoschek 2005-01-03 14:59:54 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    Compiled From Sources

I get the following crash:

1. Start umbrello.
2. Open new document.
3. Add a new Class (name does not matter) into the diagramm canvas.
4. Add three attributes to the class (names do not matter).
5. Save the document.
6. Close umbrello
7. Start umbrello.
8. Open the new document, if it is not opened automatically.
9. Double click on the class.
10. Select the topmost attribute
11. Push two times the down button such that the attribute goes down.
12. On the second click, umbrello crashes.

Here is my traceback:

[New Thread 1095452160 (LWP 8263)]
[KCrash handler]
#3  0x40eb01de in QString::QString(QString const&) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#4  0x08177533 in UMLRole::getName() const (this=0x0) at umlrole.cpp:74
#5  0x0810bee9 in CodeClassFieldDeclarationBlock::syncToParent() (
    this=0x848e798) at qstring.h:886
#6  0x0810c0c5 in CodeClassFieldDeclarationBlock::qt_invoke(int, QUObject*) (
    this=0x848e798, _id=2, _o=0xbfffd650)
    at codeclassfielddeclarationblock.moc:84
#7  0x0823d205 in CPPSourceCodeClassFieldDeclarationBlock::qt_invoke(int, QUObject*) (this=0x848e798, _id=2, _o=0xbfffd650)
    at cppsourcecodeclassfielddeclarationblock.moc:77
#8  0x0823d46b in virtual thunk to CPPSourceCodeClassFieldDeclarationBlock::qt_invoke(int, QUObject*) () at cppsourcecodeclassfielddeclarationblock.h:24
#9  0x40be5205 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#10 0x40be5089 in QObject::activate_signal(int) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#11 0x08176b55 in UMLObject::modified() (this=0x859ce88) at qmetaobject.h:261
#12 0x08210f0f in ClassifierListPage::slotClicked(QListBoxItem*) (
    this=0x862e688, item=0x86453b8) at classifierlistpage.cpp:165
#13 0x08212ce3 in ClassifierListPage::qt_invoke(int, QUObject*) (
    this=0x862e688, _id=45, _o=0xbfffd7c0) at qucom_p.h:312
#14 0x40be5289 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#15 0x40f1f2f6 in QListBox::selectionChanged(QListBoxItem*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#16 0x40cb24d0 in QListBox::setCurrentItem(QListBoxItem*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#17 0x40cb2235 in QListBox::setCurrentItem(int) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#18 0x40cb1f4b in QListBox::changeItem(QListBoxItem const*, int) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#19 0x40cb1d7d in QListBox::changeItem(QString const&, int) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#20 0x08211a08 in ClassifierListPage::slotDownClicked() (this=0x862e688)
    at classifierlistpage.cpp:344
#21 0x08212d6b in ClassifierListPage::qt_invoke(int, QUObject*) (
    this=0x862e688, _id=53, _o=0xbfffda50) at classifierlistpage.moc:145
#22 0x40be5289 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#23 0x40be5089 in QObject::activate_signal(int) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#24 0x40f16c4c in QButton::clicked() () from /usr/local/qt/lib/libqt-mt.so.3
#25 0x40c75eec in QButton::mouseReleaseEvent(QMouseEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#26 0x40c1a3e7 in QWidget::event(QEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#27 0x40b89481 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#28 0x40b88c41 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#29 0x407486fc in KApplication::notify(QObject*, QEvent*) ()
   from /usr/local/kde/lib/libkdecore.so.4
#30 0x40b21163 in QETWidget::translateMouseEvent(_XEvent const*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#31 0x40b1ed75 in QApplication::x11ProcessEvent(_XEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#32 0x40b3504f in QEventLoop::processEvents(unsigned) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#33 0x40b9b193 in QEventLoop::enterLoop() ()
   from /usr/local/qt/lib/libqt-mt.so.3
#34 0x40b89730 in QApplication::enter_loop() ()
   from /usr/local/qt/lib/libqt-mt.so.3
#35 0x40d64776 in QDialog::exec() () from /usr/local/qt/lib/libqt-mt.so.3
#36 0x08163534 in UMLDoc::showProperties(UMLWidget*) (this=0x841ede8, 
    o=0x85e2948) at umldoc.cpp:2403
#37 0x081884c6 in UMLWidget::slotMenuSelection(int) (this=0x85e2948, sel=1970)
    at umlwidget.cpp:456
#38 0x0818889d in UMLWidget::mouseDoubleClickEvent(QMouseEvent*) (
    this=0x85e2948, me=0x0) at umlwidget.cpp:594
#39 0x0814760b in ToolBarState::mouseDoubleClick(QMouseEvent*) (
    this=0x85e26b0, ome=0xbfffe3d0) at toolbarstate.cpp:110
#40 0x0817b05d in UMLView::contentsMouseDoubleClickEvent(QMouseEvent*) (
    this=0x859da00, ome=0xbfffe3d0) at umlview.cpp:818
#41 0x40cf4316 in QScrollView::viewportMouseDoubleClickEvent(QMouseEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#42 0x40cf3bd2 in QScrollView::eventFilter(QObject*, QEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#43 0x40be2dc9 in QObject::activate_filters(QEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#44 0x40be2d1a in QObject::event(QEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#45 0x40c1a372 in QWidget::event(QEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#46 0x40b89481 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#47 0x40b88c41 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#48 0x407486fc in KApplication::notify(QObject*, QEvent*) ()
   from /usr/local/kde/lib/libkdecore.so.4
#49 0x40b21163 in QETWidget::translateMouseEvent(_XEvent const*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#50 0x40b1ed75 in QApplication::x11ProcessEvent(_XEvent*) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#51 0x40b3504f in QEventLoop::processEvents(unsigned) ()
   from /usr/local/qt/lib/libqt-mt.so.3
#52 0x40b9b193 in QEventLoop::enterLoop() ()
   from /usr/local/qt/lib/libqt-mt.so.3
#53 0x40b9b050 in QEventLoop::exec() () from /usr/local/qt/lib/libqt-mt.so.3
#54 0x40b896dc in QApplication::exec() () from /usr/local/qt/lib/libqt-mt.so.3
#55 0x08133cd3 in main (argc=7, argv=0xbfffee84) at main.cpp:86
#56 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
Comment 1 Jonathan Riddell 2005-01-03 16:32:08 UTC
I can confirm this problem for KDE 3.3 branch, it goes away if you choose a non-complex code generator and remove the C++ code generation from the XMI file.

This sequence of events also causes  crash in HEAD brach but the crash is on point number 9.

Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1231761280 (LWP 9386)]
[KCrash handler]
#4  0xb73120c2 in QGListIterator::QGListIterator () from /usr/lib/libqt-mt.so.3
#5  0x081214fe in QPtrListIterator (this=0xbfffe8f0, l=@0x180)
    at qptrlist.h:157
#6  0x081c09dc in UMLView::getWidgetAssocs (this=0x0, Obj=0x86be7e8, 
    Associations=@0x871c5b4)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umlview.cpp:2081
#7  0x0825cf70 in AssocPage::fillListBox (this=0x871c530)
    at /home/jr/devel/kdesdk/umbrello/umbrello/dialogs/assocpage.cpp:78
#8  0x0825cb67 in AssocPage (this=0x871c530, parent=0x871c178, v=0x0, 
    o=0x86be7e8)
    at /home/jr/devel/kdesdk/umbrello/umbrello/dialogs/assocpage.cpp:38
#9  0x0823793e in ClassPropDlg::setupPages (this=0x86d9f10, c=0x86be7e8, 
    assoc=true)
    at /home/jr/devel/kdesdk/umbrello/umbrello/dialogs/classpropdlg.cpp:218
#10 0x08236748 in ClassPropDlg (this=0x86d9f10, parent=0x84c7820, w=0x86fe030)
    at /home/jr/devel/kdesdk/umbrello/umbrello/dialogs/classpropdlg.cpp:98
#11 0x0819f326 in UMLDoc::showProperties (this=0x84e90a8, o=0x86fe030)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umldoc.cpp:2616
#12 0x081cbaad in UMLWidget::slotMenuSelection (this=0x86fe030, sel=1979)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umlwidget.cpp:446
#13 0x08131ec1 in ClassWidget::slotMenuSelection (this=0x86fe030, sel=1979)
    at /home/jr/devel/kdesdk/umbrello/umbrello/classwidget.cpp:309
#14 0x081cc105 in UMLWidget::mouseDoubleClickEvent (this=0x86fe030, 
    me=0x85a4b70) at /home/jr/devel/kdesdk/umbrello/umbrello/umlwidget.cpp:597
#15 0x0817f63e in ToolBarState::mouseDoubleClick (this=0x86fdd18, 
    ome=0xbfffecc0)
    at /home/jr/devel/kdesdk/umbrello/umbrello/toolbarstate.cpp:112
#16 0x0818020e in ToolBarStateArrow::mouseDoubleClick (this=0x86fdd18, 
    ome=0xbfffecc0)
    at /home/jr/devel/kdesdk/umbrello/umbrello/toolbarstatearrow.cpp:100
#17 0x081bafb1 in UMLView::contentsMouseDoubleClickEvent (this=0x86c1178, 
    ome=0xbfffecc0) at /home/jr/devel/kdesdk/umbrello/umbrello/umlview.cpp:846
#18 0xb716ffd2 in QScrollView::viewportMouseDoubleClickEvent ()
   from /usr/lib/libqt-mt.so.3
#19 0xb716f7ca in QScrollView::eventFilter () from /usr/lib/libqt-mt.so.3
#20 0xb7057e4e in QObject::activate_filters () from /usr/lib/libqt-mt.so.3
#21 0xb7057d7c in QObject::event () from /usr/lib/libqt-mt.so.3
#22 0xb70905ff in QWidget::event () from /usr/lib/libqt-mt.so.3
#23 0xb6ffdbbf in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#24 0xb6ffd2b4 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#25 0xb76944f0 in KApplication::notify (this=0xbffff750, receiver=0x86bf4f0, 
    event=0xbffff1b0) at /home/jr/devel/kdelibs/kdecore/kapplication.cpp:543
#26 0xb6f92630 in QETWidget::translateMouseEvent () from /usr/lib/libqt-mt.so.3
#27 0xb6f902be in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#28 0xb6fa7194 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#29 0xb700ff18 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#30 0xb700fdc8 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#31 0xb6ffde11 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#32 0x081663b5 in main (argc=1, argv=0xbffff8f4)
    at /home/jr/devel/kdesdk/umbrello/umbrello/main.cpp:91
Comment 2 Oliver Kellogg 2005-01-03 21:21:50 UTC
Jonathan Riddell wrote:
> This sequence of events also causes crash in HEAD branch but
> the crash is on point number 9. 
 
Tried it with the C++ generators old and new, cannot confirm.
CVS HEAD has been in motion these days, did you "make clean"?
Comment 3 Oliver Kellogg 2005-01-04 12:13:27 UTC
BTW, while attempting to reproduce this problem I found a different one:
The changed attribute/operation order is not reflected in the list view,
and is not preserved upon reload.
I have fixed that and will commit as soon as CVS becomes warmer again.
Comment 4 Jonathan Riddell 2005-01-06 01:18:02 UTC
Seems to work in CVS HEAD now.
Comment 5 Oliver Kellogg 2005-01-07 16:17:05 UTC
CVS commit by okellogg: 

compare(): Reflect the changed attribute/operation order in the list view
 and restore it upon reload.
CCBUG:96216


  M +34 -4     umllistviewitem.cpp   1.68


--- kdesdk/umbrello/umbrello/umllistviewitem.cpp  #1.67:1.68
@@ -522,10 +522,40 @@ void UMLListViewItem::cancelRename(int c
 int UMLListViewItem::compare(QListViewItem *other, int col, bool ascending) const
 {
+        UMLListViewItem *ulvi = static_cast<UMLListViewItem*>(other);
         Uml::ListView_Type ourType = getType();
-        Uml::ListView_Type otherType = static_cast<UMLListViewItem*>( other )->getType();
+        Uml::ListView_Type otherType = ulvi->getType();
 
-        if ( ourType == otherType )
+        if ( ourType == otherType ) {
+                UMLObject *otherObj = ulvi->getUMLObject();
+                if (m_pObject == NULL || otherObj == NULL)
                 return key( col, ascending ).compare( other->key( col, ascending) );
-
+                if (ourType == Uml::lvt_Attribute) {
+                        UMLClass *ourParent = dynamic_cast<UMLClass*>(m_pObject->parent());
+                        UMLClass *otherParent = dynamic_cast<UMLClass*>(otherObj->parent());
+                        if (ourParent == NULL || otherParent == NULL || ourParent != otherParent) {
+                                kdError() << "UMLListViewItem::compare(UMLAttribute): ourParent="
+                                          << ourParent << ", otherParent=" << otherParent << endl;
+                                return key( col, ascending ).compare( other->key( col, ascending) );
+                        }
+                        UMLAttributeList atts = ourParent->getAttributeList();
+                        int myIndex = atts.findRef( static_cast<UMLAttribute*>(m_pObject) );
+                        int otherIndex = atts.findRef( static_cast<UMLAttribute*>(otherObj) );
+                        return (myIndex < otherIndex ? -1 : myIndex > otherIndex ? 1 : 0);
+                } else if (ourType == Uml::lvt_Operation) {
+                        UMLClassifier *ourParent = dynamic_cast<UMLClassifier*>(m_pObject->parent());
+                        UMLClassifier *otherParent = dynamic_cast<UMLClassifier*>(otherObj->parent());
+                        if (ourParent == NULL || otherParent == NULL || ourParent != otherParent) {
+                                kdError() << "UMLListViewItem::compare(UMLOperation): ourParent="
+                                          << ourParent << ", otherParent=" << otherParent << endl;
+                                return key( col, ascending ).compare( other->key( col, ascending) );
+                        }
+                        UMLOperationList ops = ourParent->getOpList();
+                        int myIndex = ops.findRef( static_cast<UMLOperation*>(m_pObject) );
+                        int otherIndex = ops.findRef( static_cast<UMLOperation*>(otherObj) );
+                        return (myIndex < otherIndex ? -1 : myIndex > otherIndex ? 1 : 0);
+                } else {
+                        return key( col, ascending ).compare( other->key( col, ascending) );
+                }
+        }
         if ( ourType < otherType )
                 return -1;


Comment 6 Oliver Kellogg 2005-01-10 02:18:10 UTC
Please try again with cvs head, it works for me.