Summary: | crash when cutting last diagram left | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | Sebastian Stein <seb.kde> |
Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | caleb |
Priority: | HI | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Fix 59774 and the other crash on deleting the diagram (?????) |
Description
Sebastian Stein
2003-06-14 18:39:18 UTC
I am going to add my bug to this bug because its too similar to make a new entry. I am trying to delete a pre-existing class diagram and not the default class diagram of a new project. The crash occurs when I select the diagram -> right click -> select "delete" -> "Yes". I found the function in class UMLDoc but was not sure what is happening there from the stack trace below. [New Thread 16384 (LWP 28549)] 0x4b4dbeb9 in wait4 () from /lib/libc.so.6 #0 0x4b4dbeb9 in wait4 () from /lib/libc.so.6 #1 0x4b559214 in __DTOR_END__ () from /lib/libc.so.6 #2 0x4b2ceae3 in waitpid () from /lib/libpthread.so.0 #3 0x4a9ee53d in KCrash::defaultCrashHandler(int) () from /usr/kde/3.1/lib/libkdecore.so.4 #4 <signal handler called> #5 0x00630061 in ?? () #6 0x080e4b60 in UMLDoc::removeView(UMLView*) () #7 0x080e97f2 in UMLDoc::removeDiagram(int) () #8 0x080bbf07 in UMLListView::popupMenuSel(int) () #9 0x080c255c in UMLListView::qt_invoke(int, QUObject*) () #10 0x4ad79639 in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/qt/3/lib/libqt-mt.so.3 #11 0x4ad79715 in QObject::activate_signal(int, int) () from /usr/qt/3/lib/libqt-mt.so.3 #12 0x4b06ed82 in QPopupMenu::activated(int) () from /usr/qt/3/lib/libqt-mt.so.3 #13 0x4ae62cfc in QPopupMenu::actSig(int, bool) () from /usr/qt/3/lib/libqt-mt.so.3 #14 0x4ae67023 in QPopupMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/qt/3/lib/libqt-mt.so.3 #15 0x4adad90c in QWidget::event(QEvent*) () from /usr/qt/3/lib/libqt-mt.so.3 #16 0x4ad1b644 in QApplication::internalNotify(QObject*, QEvent*) () from /usr/qt/3/lib/libqt-mt.so.3 #17 0x4ad1ac23 in QApplication::notify(QObject*, QEvent*) () from /usr/qt/3/lib/libqt-mt.so.3 #18 0x4a9605f9 in KApplication::notify(QObject*, QEvent*) () from /usr/kde/3.1/lib/libkdecore.so.4 #19 0x4acc0926 in QETWidget::translateMouseEvent(_XEvent const*) () from /usr/qt/3/lib/libqt-mt.so.3 #20 0x4acbe693 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/qt/3/lib/libqt-mt.so.3 #21 0x4acd3cc1 in QEventLoop::processEvents(unsigned) () from /usr/qt/3/lib/libqt-mt.so.3 #22 0x4ad2f466 in QEventLoop::enterLoop() () from /usr/qt/3/lib/libqt-mt.so.3 #23 0x4ad2f308 in QEventLoop::exec() () from /usr/qt/3/lib/libqt-mt.so.3 #24 0x4ad1b871 in QApplication::exec() () from /usr/qt/3/lib/libqt-mt.so.3 #25 0x08109d0e in main () #26 0x4b443dc4 in __libc_start_main () from /lib/libc.so.6 Two problems, first one (reported by Sebastian) is that it crashes when cutting the last diagram in existance. It tries to delete the widgets from the diagram after it has been deleted. The problem is in UMLApp::slotEditCut, the fromview variable is set to true even though it is not from the view that we're cutting. Need to find a better way to set fromview. I've made a temporary fix in the mean time in UMLApp::slotDeleteSelectedWidget(). The problem Stephen reported occurs when deleteing diagrams that have been saved and loaded and which contain associations. UMLView::removeAllWidgets uses queryList("UMLWidget") which in these situations returns a count much higher than it should and some of the QObjects it contains causes the program to crash as soon as you touch them. I have no idea what could cause that. Everything works fine for diagrams which contain associations but which havn't been saved and loaded. This patch should solve the second bug (deleting a diagram with associations in it and which has been saved/loaded) : --- umlview.cpp 2003-08-31 22:46:15.000000000 +0200 +++ umlview.new.cpp 2003-08-31 22:47:27.000000000 +0200 @@ -2197,16 +2197,31 @@ void UMLView::removeAllWidgets() { - //FIXME bug 59774 - //this queryList returns a too high count and list items which cause the program to crash - //when you touch them on diagrams that contain associations /and/ have been saved and loaded - QObjectList * l = queryList( "UMLWidget"); - QObjectListIt it( *l ); + QObjectList * l = queryList("UMLWidget"); + QObjectListIt it(*l); UMLWidget * temp = 0; - while ( (temp=(UMLWidget*)it.current()) != 0 ) { + while ((temp=(UMLWidget*)it.current()) != 0) { ++it; - if( !( temp -> getBaseType() == wt_Text && ((FloatingText *)temp)-> getRole() != tr_Floating ) ) { - removeWidget( temp ); + if( !(temp->getBaseType() == wt_Text && ((FloatingText *)temp)->getRole() != tr_Floating) ) { + removeWidget(temp); + + /* Update list; removing a widget will also delete the associations + * connected to it; so we have to update the list, because other + * widgets might be already deleted + */ + */ + QObjectList * currentList = queryList("UMLWidget"); + QObjectListIt OldListIt(*l); + + while ((temp = (UMLWidget*)OldListIt.current()) != 0) + { + ++OldListIt; + if (!currentList->contains(temp)) + { + l->remove(temp); + } + } + it.toFirst(); + delete currentList; } } delete l; In fact, it is the same problem as in the [63248] bug (crash when cutting a class). The fact that it must be saved/loaded to crash (before applying this patch :)) is not really true. If you make a diagram with an association and you rename it (creating the widgets which make finally crash), when you delete the diagram it crashes. Now you can safely cut the last diagram, but Umbrello will crash when clicking on the "Logical View" folder in the tree view: create a class diagram create 2 new classes in the diagram delete the class diagram from the tree view click on the top folder, Umbrello will crash Backtrace: #5 0x08106bbe in UMLView::clearSelected() (this=0x840c1d8) at /usr/lib/qt-3.1.2/include/qptrlist.h:78 #6 0x080ef332 in UMLListView::contentsMousePressEvent(QMouseEvent*) ( this=0x83b2610, me=0xbfffed00) at umldoc.h:501 #7 0x40b6273c in QScrollView::viewportMousePressEvent(QMouseEvent*) () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 #8 0x40b62084 in QScrollView::eventFilter(QObject*, QEvent*) () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 #9 0x40b339d2 in QListView::eventFilter(QObject*, QEvent*) () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 #10 0x40a644ae in QObject::activate_filters(QEvent*) () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 #11 0x40a643d1 in QObject::event(QEvent*) () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 #12 0x40a9a9ec in QWidget::event(QEvent*) () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 #13 0x40a08734 in QApplication::internalNotify(QObject*, QEvent*) () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 Actually Umbrello will always crash after deleting a diagram and selecting another one. So just create 2 diagrams, delete one and select the other and Umbrello will crash. Backtrace for this case: #13 0x4066b2a9 in KApplication::notify(QObject*, QEvent*) () from /opt/kde/lib/libkdecore.so.4 #14 0x40a99a63 in QWidget::show() () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 #15 0x0810d5a0 in UMLView::show() (this=0x8404208) at umlview.cpp:2837 #16 0x40b89f92 in QWidgetStack::raiseWidget(QWidget*) () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 #17 0x08128c29 in UMLApp::setCurrentView(UMLView*) (this=0x0, view=0x40e64058) at uml.cpp:1587 #18 0x0811716f in UMLDoc::changeCurrentView(int) (this=0x8404208, id=1) at umldoc.cpp:1042 #19 0x080ef671 in UMLListView::contentsMousePressEvent(QMouseEvent*) ( this=0x83ad9b0, me=0xbfffed20) at umllistview.cpp:121 #20 0x40b6273c in QScrollView::viewportMousePressEvent(QMouseEvent*) () from /usr/lib/qt-3.1.2/lib/libqt-mt.so.3 The problem is that current view was pointing to 0 or to a deleted object. Umbrello crashes when you delete or cut the last diagram and then do anything that tries to access the current view. The following patch 1) Fixes the crash 2) Automatically creates a new diagram if the last one is removed (now you get a nice gray area where the diagrams should be ) Someone please review the patch so that I can apply it. Created attachment 3311 [details]
Fix 59774 and the other crash on deleting the diagram (?????)
*** Bug 68126 has been marked as a duplicate of this bug. *** Subject: Re: [Uml-devel] crash when cutting last diagram left lparrab@gmx.net <lparrab@gmx.net> [031120 23:48]: > The problem is that current view was pointing to 0 or to a deleted object. > Umbrello crashes when you delete or cut the last diagram and then do > anything that tries to access the current view. > > The following patch > 1) Fixes the crash > 2) Automatically creates a new diagram if the last one is removed (now you > get a nice gray area where the diagrams should be ) > > Someone please review the patch so that I can apply it. I understand your changes and the problem is solved. So go ahead and commit it! Steinchen Patch applied |