Bug 63248 - Crash when cutting a class
Summary: Crash when cutting a class
Status: RESOLVED FIXED
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-08-25 17:34 UTC by Sebastian Stein
Modified: 2003-08-31 15:38 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Cut one of both classes and it will crash (3.55 KB, text/plain)
2003-08-25 17:36 UTC, Sebastian Stein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Stein 2003-08-25 17:34:48 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.2 
OS:          Linux

Just cut one of the 2 classes in the treeview and Umbrello will crash.

Backtrace: 

0x411c0f29 in wait4 () from /lib/libc.so.6
#0  0x411c0f29 in wait4 () from /lib/libc.so.6
#1  0x41241234 in sys_sigabbrev () from /lib/libc.so.6
#2  0x40fd5103 in waitpid () from /lib/libpthread.so.0
#3  0x40721dcd in KCrash::defaultCrashHandler(int) ()
   from /opt/kde/lib/libkdecore.so.4
#4  0x4113cb48 in sigaction () from /lib/libc.so.6
#5  0x080e1df3 in UMLView::qt_invoke(int, QUObject*) (this=0x837e3f0, _id=69, 
    _o=0xbfffe5e0) at /usr/lib/qt-3.1.2/include/private/qucom_p.h:312
#6  0x40a9f710 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#7  0x080ee8b3 in UMLDoc::sigObjectRemoved(UMLObject*) (this=0x8321b80, 
    t0=0x837c900) at umldoc.moc:221
#8  0x080e8630 in UMLDoc::removeUMLObject(UMLObject*) (this=0x8321b80, 
    o=0x837c900) at umldoc.cpp:1001
#9  0x080befa7 in UMLListView::popupMenuSel(int) (this=0x832ac90, sel=1959)
    at umllistview.cpp:287
#10 0x080c1cd2 in UMLListView::slotCutSuccessful() (this=0x832ac90)
    at umllistview.cpp:1321
#11 0x080c4b0c in UMLListView::qt_invoke(int, QUObject*) (this=0x832ac90, 
    _id=117, _o=0xbfffe9e0) at umllistview.moc:227
#12 0x40a9f710 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#13 0x40a9f63d in QObject::activate_signal(int) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#14 0x080f9fed in UMLApp::sigCutSuccessful() (this=0x82bdb30)
    at /usr/lib/qt-3.1.2/include/qmetaobject.h:261
#15 0x080f5839 in UMLApp::slotEditCut() (this=0xbfffe9f4) at uml.cpp:766
#16 0x080bf0dc in UMLListView::popupMenuSel(int) (this=0x832ac90, sel=1963)
    at umllistview.cpp:349
#17 0x080c4aa6 in UMLListView::qt_invoke(int, QUObject*) (this=0x832ac90, 
    _id=111, _o=0xbfffedb0) at /usr/lib/qt-3.1.2/include/private/qucom_p.h:388
#18 0x40a9f799 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#19 0x40a9f875 in QObject::activate_signal(int, int) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#20 0x40d92e92 in QPopupMenu::activated(int) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#21 0x40b88e5c in QPopupMenu::actSig(int, bool) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#22 0x40b8d183 in QPopupMenu::mouseReleaseEvent(QMouseEvent*) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#23 0x40ad3a6c in QWidget::event(QEvent*) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#24 0x40a41734 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#25 0x40a40f63 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#26 0x406a52a9 in KApplication::notify(QObject*, QEvent*) ()
   from /opt/kde/lib/libkdecore.so.4
#27 0x409e70c6 in QETWidget::translateMouseEvent(_XEvent const*) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#28 0x409e4e5b in QApplication::x11ProcessEvent(_XEvent*) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#29 0x409fa0d1 in QEventLoop::processEvents(unsigned) ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#30 0x40a555d6 in QEventLoop::enterLoop() ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#31 0x40a55478 in QEventLoop::exec() ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#32 0x40a41961 in QApplication::exec() ()
   from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3
#33 0x08106b0f in main (argc=1, argv=0xbffff8a4) at main.cpp:86
#34 0x41128bb4 in __libc_start_main () from /lib/libc.so.6
Comment 1 Sebastian Stein 2003-08-25 17:36:35 UTC
Created attachment 2308 [details]
Cut one of both classes and it will crash
Comment 2 Jean-Louis Houberdon 2003-08-28 17:10:55 UTC
I found a way to correct the bug :

--- umlview.old 2003-08-28 16:47:42.000000000 +0200
+++ umlview.cpp 2003-08-28 16:50:24.000000000 +0200
@@ -586,16 +586,32 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 void UMLView::slotObjectRemoved(UMLObject * o) {
        m_bPaste = false;
-       int id = o -> getID();
-       QObjectList * l = queryList( "UMLWidget");
-       QObjectListIt it( *l );
+       int id = o->getID();
+       QObjectList * l = queryList("UMLWidget");
+       QObjectListIt it(*l);
        UMLWidget *obj;
 
-       while ((obj=(UMLWidget*)it.current()) != 0 ) {
+       while ((obj=(UMLWidget*)it.current()) != 0) {
                ++it;
-               if(obj -> getID() == id)
+               if(obj->getID() == id)
                {
                        removeWidget(obj);
+
+                       /* Update list */
+                       QObjectList * currentList = queryList("UMLWidget");
+                       QObjectListIt OldListIt(*l);
+
+                       while ((obj = (UMLWidget*)OldListIt.current()) != 0)
+                       {
+                               ++OldListIt;
+                               if (!currentList->contains(obj))
+                               {
+                                       l->remove(obj);
+                               }
+                       }
+                       it.toFirst();
+                       delete currentList;
+
                }
        }
        delete l;

Justification of the correction : When you remove the widget (i.e. here the class widget), you remove association widgets too in the same time. So, when you come back to the loop and ask for "obj->getID()" on the next widget, it is possible you have deleted it meanwhile. So, it's necessary to update the object list to be sure you don't have a widget which doesn't exist.

Jean-Louis Houberdon
Comment 3 Sebastian Stein 2003-08-31 15:38:26 UTC
Subject: Re: Crash when cutting a class

fixed by Jean-Louis Houberdon:

When you remove the widget (i.e. here the class widget), you remove association widgets too in the same time. So, when you come back to the loop and ask for "obj->getID()" on the next widget, it is possible you have deleted it meanwhile. So, it's necessary to update the object list to be sure you don't have a widget which doesn't exist.