Bug 462627 - Crash on exit
Summary: Crash on exit
Status: REOPENED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-04 11:39 UTC by Oliver Kellogg
Modified: 2022-12-27 05:42 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.37.70 (KDE releases 23.03.70)
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Kellogg 2022-12-04 11:39:01 UTC
SUMMARY
***
Umbrello crashed on exit when using command line option "--export".
Analysis shows that the crash may also happen in other circumstances.
***


STEPS TO REPRODUCE
1. Start umbrello with options: --export png
2. The export is successful but short before exiting there is the crash (see OBSERVED).

OBSERVED RESULT

[KCrash Handler]
#5  0x00000000005e83e0 in AssociationWidget::linePathStartsAt(UMLWidget const*) const (this=this@entry=0x3018f80, widget=widget@entry=0x0) at /umbrello/master/umbrello/umlwidgets/associationwidget.cpp:1206
#6  0x00000000005eea35 in AssociationWidget::setStartAndEndPoint(AssociationWidget*, UMLWidget*) (assocwidget=0x3018f80, pWidget=pWidget@entry=0x2ff9b70) at /umbrello/master/umbrello/umlwidgets/associationwidget.cpp:3029
#7  0x00000000005ef5ac in AssociationWidget::updateAssociations(UMLWidget*, QList<QPointer<AssociationWidget> >) (pWidget=0x2ff9b70, list=...) at /umbrello/master/umbrello/umlwidgets/associationwidget.cpp:3116
#8  0x00000000005efb67 in AssociationWidget::calculateEndingPoints() (this=0x301ad90) at /umbrello/master/umbrello/umlwidgets/associationwidget.cpp:1711
#9  0x00000000005f08cd in AssociationWidget::widgetMoved(UMLWidget*, double, double) (this=0x301ad90, widget=widget@entry=0x2ff9b70, dx=dx@entry=10, dy=dy@entry=-20) at /umbrello/master/umbrello/umlwidgets/associationwidget.cpp:1858
#10 0x000000000061cb86 in UMLWidget::adjustAssocs(double, double) (this=0x2ff9b70, dx=10, dy=-20) at /umbrello/master/umbrello/umlwidgets/umlwidget.cpp:1335
#11 0x000000000061c137 in UMLWidget::updateGeometry(bool) (this=this@entry=0x2ff9b70, withAssocs=withAssocs@entry=true) at /umbrello/master/umbrello/umlwidgets/umlwidget.cpp:1886
#12 0x000000000061ce79 in UMLWidget::removeAssoc(AssociationWidget*) (this=0x2ff9b70, pAssoc=<optimized out>) at /umbrello/master/umbrello/umlwidgets/umlwidget.cpp:1304
#13 0x0000000000669d82 in AssociationWidgetRole::cleanup() (this=this@entry=0x30191e8) at /umbrello/master/umbrello/umlwidgets/associationwidgetrole.cpp:31
#14 0x00000000005eb321 in AssociationWidget::cleanup() (this=this@entry=0x3018f80) at /umbrello/master/umbrello/umlwidgets/associationwidget.cpp:1284
#15 0x0000000000480ece in UMLScene::removeWidgetCmd(AssociationWidget*) (this=this@entry=0x2fe6fd0, pAssoc=pAssoc@entry=0x3018f80) at /umbrello/master/umbrello/umlscene.cpp:2269
#16 0x0000000000483634 in UMLScene::removeAssociations(UMLWidget*) (this=this@entry=0x2fe6fd0, widget=widget@entry=0x2ff7530) at /umbrello/master/umbrello/umlscene.cpp:2316
#17 0x0000000000488de7 in UMLScene::removeWidgetCmd(UMLWidget*) (this=this@entry=0x2fe6fd0, o=o@entry=0x2ff7530) at /umbrello/master/umbrello/umlscene.cpp:1328
#18 0x0000000000488fd3 in UMLScene::removeOwnedWidgets(UMLWidget*) (this=this@entry=0x2fe6fd0, o=o@entry=0x2fe81b0) at /umbrello/master/umbrello/umlscene.cpp:1374
#19 0x0000000000488df2 in UMLScene::removeWidgetCmd(UMLWidget*) (this=this@entry=0x2fe6fd0, o=o@entry=0x2fe81b0) at /umbrello/master/umbrello/umlscene.cpp:1330
#20 0x000000000048cf0b in UMLScene::removeAllWidgets() (this=this@entry=0x2fe6fd0) at /umbrello/master/umbrello/umlscene.cpp:2380
#21 0x000000000048cfb9 in UMLScene::~UMLScene() (this=0x2fe6fd0, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umlscene.cpp:329
#22 0x000000000048d039 in UMLScene::~UMLScene() (this=0x2fe6fd0, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umlscene.cpp:333
#23 0x0000000000495126 in UMLView::~UMLView() (this=0x2fca150, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umlview.cpp:45
#24 0x0000000000495149 in UMLView::~UMLView() (this=0x2fca150, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umlview.cpp:46
#25 0x00000000005c7e9e in qDeleteAll<QList<QPointer<UMLView> >::const_iterator>(QList<QPointer<UMLView> >::const_iterator, QList<QPointer<UMLView> >::const_iterator) (begin=..., end=...) at /usr/include/QtCore/qalgorithms.h:322
#26 0x00000000005c7eed in qDeleteAll<QList<QPointer<UMLView> > >(QList<QPointer<UMLView> > const&) (c=...) at /usr/include/QtCore/qalgorithms.h:330
#27 0x00000000005c4dbf in UMLFolder::~UMLFolder() (this=0x2bd8d60, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umlmodel/folder.cpp:49
#28 0x00000000005c4e09 in UMLFolder::~UMLFolder() (this=0x2bd8d60, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umlmodel/folder.cpp:51
#29 0x0000000000464c06 in UMLDoc::~UMLDoc() (this=0x2b74fd0, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umldoc.cpp:205
#30 0x0000000000464ce9 in UMLDoc::~UMLDoc() (this=0x2b74fd0, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umldoc.cpp:213
#31 0x00000000004536f0 in UMLApp::~UMLApp() (this=0x2897df0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /umbrello/master/umbrello/uml.cpp:342
#32 0x0000000000453789 in UMLApp::~UMLApp() (this=0x2897df0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /umbrello/master/umbrello/uml.cpp:344
#33 0x0000000000441153 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /umbrello/master/umbrello/main.cpp:240

The trigger of the crash is the call to UMLApp destructor in the main program,
    delete uml;

EXPECTED RESULT
No crash shall happen.

SOFTWARE/OS VERSIONS
Linux: OpenSUSE 13.2 (x86_64)
KDE Frameworks Version: kdelibs 4.14.9
Qt Version: 4.8.6
Umbrello Version : git master @ b38382a4
Comment 1 Oliver Kellogg 2022-12-04 11:49:54 UTC
Git commit 03b0d2f64495a016dda1998a8f53c706bf4312bb by Oliver Kellogg.
Committed on 04/12/2022 at 11:49.
Pushed by okellogg into branch 'master'.

umbrello/umlwidgets/umlwidget.cpp
- In function removeAssoc, if changesShape() is true then refrain from
  calling updateGeometry() if UMLApp::app()->shuttingDown() is true.
  Reason: Otherwise a signal is propagated which leads to the crash.
FIXED-IN: 2.37.70 (KDE releases 23.03.70)

M  +1    -1    umbrello/umlwidgets/umlwidget.cpp

https://invent.kde.org/sdk/umbrello/commit/03b0d2f64495a016dda1998a8f53c706bf4312bb
Comment 2 Robert Hairgrove 2022-12-04 14:07:46 UTC
Wouldn't it be better to create UMLApp as a local variable, i.e. on the stack, in the main() function?

Also, it seems that there is this at line 173:
    QPointer<UMLApp> uml;

Doesn't this handle deletion of 'uml' automatically?

--

(In reply to Oliver Kellogg from comment #1)
> Git commit 03b0d2f64495a016dda1998a8f53c706bf4312bb by Oliver Kellogg.
> Committed on 04/12/2022 at 11:49.
> Pushed by okellogg into branch 'master'.
> 
> umbrello/umlwidgets/umlwidget.cpp
> - In function removeAssoc, if changesShape() is true then refrain from
>   calling updateGeometry() if UMLApp::app()->shuttingDown() is true.
>   Reason: Otherwise a signal is propagated which leads to the crash.
> FIXED-IN: 2.37.70 (KDE releases 23.03.70)
> 
> M  +1    -1    umbrello/umlwidgets/umlwidget.cpp
> 
> https://invent.kde.org/sdk/umbrello/commit/
> 03b0d2f64495a016dda1998a8f53c706bf4312bb
Comment 3 Oliver Kellogg 2022-12-04 16:15:29 UTC
Git commit bae76adb1a9be5c9535fdc4e7e5b10b7b8558566 by Oliver Kellogg.
Committed on 04/12/2022 at 16:15.
Pushed by okellogg into branch 'master'.

(In reply to Robert Hairgrove from comment #2)
> Wouldn't it be better to create UMLApp as a local variable, i.e.
> on the stack, in the main() function?

To be investigated separately.

> Also, it seems that there is this at line 173:
>     QPointer<UMLApp> uml;
>
> Doesn't this handle deletion of 'uml' automatically?

Absolutely right, my oversight. Thanks.

umbrello/main.cpp
- In main program remove the line `delete uml`.

M  +0    -1    umbrello/main.cpp

https://invent.kde.org/sdk/umbrello/commit/bae76adb1a9be5c9535fdc4e7e5b10b7b8558566
Comment 4 Oliver Kellogg 2022-12-11 15:29:03 UTC
Reopening this was the right thing to do - as confirmed by further SEGV; this time
- without using command line options
- loading an XMI file (UmbrelloArchitecture.xmi)
- doing some editing
- exiting without save (i.e. discard changes)

#0  in QListData::size (this=0x30) at /usr/include/qt5/QtCore/qlist.h:115
#1  in QList<QTreeWidgetItem*>::count (this=0x30) at /usr/include/qt5/QtCore/qlist.h:359
#2  in QTreeWidgetItem::childCount (this=0x0) at /usr/include/qt5/QtWidgets/qtreewidget.h:193
#3  in UMLListView::findView (this=0x1421b90, v=0x23f8390) at /umbrello/master/umbrello/umllistview.cpp:1382
#4  in UMLApp::setCurrentView (this=0xd3f380, view=0x23f8390, updateTreeView=true)
    at /umbrello/master/umbrello/uml.cpp:3334
#5  in UMLDoc::changeCurrentView (this=0x10f9aa0, id="JBFSUyhmy1cS")
    at /umbrello/master/umbrello/umldoc.cpp:1840
#6  in UMLApp::slotTabChanged (this=0xd3f380, index=0) at /umbrello/master/umbrello/uml.cpp:3382
#7  in UMLApp::qt_static_metacall (_o=0xd3f380, _c=QMetaObject::InvokeMetaMethod, _id=81, _a=0x7fffffffb470)
    at /umbrello/master/build/umbrello/libumbrello_autogen/EWIEGA46WW/moc_uml.cpp:564
#8  in doActivate<false> (sender=0x1349e10, signal_index=7, argv=0x7fffffffb470) at kernel/qobject.cpp:3931
#9  in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7ffff64cb540 <QTabWidget::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffb470) at kernel/qobject.cpp:3979
#10 in QTabWidget::currentChanged (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qtabwidget.cpp:326
#11 in doActivate<false> (sender=0x1352aa0, signal_index=7, argv=0x7fffffffb570) at kernel/qobject.cpp:3931
#12 in QMetaObject::activate (sender=sender@entry=0x1352aa0, m=m@entry=0x7ffff64c9fa0 <QTabBar::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffb570) at kernel/qobject.cpp:3979
#13 in QTabBar::currentChanged (this=this@entry=0x1352aa0, _t1=<optimized out>) at .moc/moc_qtabbar.cpp:338
#14 in QTabBar::setCurrentIndex (this=this@entry=0x1352aa0, index=<optimized out>) at widgets/qtabbar.cpp:1457
#15 in QTabBar::removeTab (this=0x1352aa0, index=<optimized out>, index@entry=0) at widgets/qtabbar.cpp:1108
#16 in QTabWidgetPrivate::_q_removeTab (index=0, this=<optimized out>) at widgets/qtabwidget.cpp:802
#17 QTabWidget::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at .moc/moc_qtabwidget.cpp:178
#18 in doActivate<false> (sender=0x1351ce0, signal_index=8, argv=0x7fffffffb710) at kernel/qobject.cpp:3931
#19 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7ffff64c9980 <QStackedWidget::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7fffffffb710) at kernel/qobject.cpp:3979
#20 in QStackedWidget::widgetRemoved (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qstackedwidget.cpp:226
#21 in doActivate<false> (sender=0x1351bf0, signal_index=3, argv=0x7fffffffb810) at kernel/qobject.cpp:3931
#22 in QMetaObject::activate (sender=sender@entry=0x1351bf0, m=m@entry=0x7ffff64b9fe0 <QStackedLayout::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffb810) at kernel/qobject.cpp:3979
#23 in QStackedLayout::widgetRemoved (this=this@entry=0x1351bf0, _t1=<optimized out>, _t1@entry=0) at .moc/moc_qstackedlayout.cpp:220
#24 in QStackedLayout::takeAt (this=0x1351bf0, index=0) at kernel/qstackedlayout.cpp:282
#25 in removeWidgetRecursively (li=<optimized out>, w=0x23137a0) at kernel/qlayout.cpp:573
#26 in QLayout::widgetEvent (this=<optimized out>, e=e@entry=0x7fffffffb960) at kernel/qlayout.cpp:629
#27 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x1351ce0, e=0x7fffffffb960) at kernel/qapplication.cpp:3626
#28 in QCoreApplication::notifyInternal2 (receiver=0x1351ce0, event=0x7fffffffb960) at kernel/qcoreapplication.cpp:1064
#29 in QObjectPrivate::setParent_helper (this=0x231a9c0, o=0x0) at kernel/qobject.cpp:2182
#30 in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at kernel/qobject.cpp:1126
#31 in UMLView::~UMLView (this=0x23137a0, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umlview.cpp:46
#32 in UMLView::~UMLView (this=0x23137a0, __in_chrg=<optimized out>) at /umbrello/master/umbrello/umlview.cpp:46
#33 in UMLDoc::removeView (this=0x10f9aa0, view=0x23137a0, enforceCurrentView=false)
    at /umbrello/master/umbrello/umldoc.cpp:341
#34 in UMLFolder::removeAllViews (this=0x1044300) at /umbrello/master/umbrello/umlmodel/folder.cpp:242
#35 in UMLDoc::removeAllViews (this=0x10f9aa0) at /umbrello/master/umbrello/umldoc.cpp:2986
#36 in UMLDoc::closeDocument (this=0x10f9aa0) at /umbrello/master/umbrello/umldoc.cpp:463
#37 in UMLDoc::saveModified (this=0x10f9aa0) at /umbrello/master/umbrello/umldoc.cpp:421
#38 in UMLApp::slotFileQuit (this=0xd3f380) at /umbrello/master/umbrello/uml.cpp:1668
#39 in UMLApp::qt_static_metacall (_o=0xd3f380, _c=QMetaObject::InvokeMetaMethod, _id=13, _a=0x7fffffffbeb0)
    at /umbrello/master/build/umbrello/libumbrello_autogen/EWIEGA46WW/moc_uml.cpp:496
#40 in doActivate<false> (sender=0x10ae4e0, signal_index=4, argv=0x7fffffffbeb0) at kernel/qobject.cpp:3931
#41 in QMetaObject::activate (sender=sender@entry=0x10ae4e0, m=m@entry=0x7ffff64b8d20 <QAction::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7fffffffbeb0) at kernel/qobject.cpp:3979
#42 in QAction::triggered (this=this@entry=0x10ae4e0, _t1=<optimized out>) at .moc/moc_qaction.cpp:376
#43 in QAction::activate (this=0x10ae4e0, event=<optimized out>) at kernel/qaction.cpp:1161
#44 in QMenuPrivate::activateCausedStack (this=this@entry=0x10ef9c0, causedStack={...}, action=action@entry=0x10ae4e0, 
    action_e=action_e@entry=QAction::Trigger, self=self@entry=true) at widgets/qmenu.cpp:1384
#45 in QMenuPrivate::activateAction (this=0x10ef9c0, action=0x10ae4e0, action_e=QAction::Trigger, self=<optimized out>)
    at widgets/qmenu.cpp:1461
#46 in QWidget::event (this=0x10c7420, event=0x7fffffffc490) at kernel/qwidget.cpp:9043
#47 in QApplicationPrivate::notify_helper (this=this@entry=0xc4d6b0, receiver=receiver@entry=0x10c7420, e=e@entry=0x7fffffffc490)
    at kernel/qapplication.cpp:3637
#48 in QApplication::notify (this=<optimized out>, receiver=0x10c7420, e=<optimized out>) at kernel/qapplication.cpp:3081
#49 in QCoreApplication::notifyInternal2 (receiver=0x10c7420, event=0x7fffffffc490) at kernel/qcoreapplication.cpp:1064
#50 in QApplicationPrivate::sendMouseEvent (receiver=0x10c7420, event=event@entry=0x7fffffffc490, alienWidget=<optimized out>, 
    nativeWidget=0x10c7420, buttonDown=buttonDown@entry=<qt_button_down>, lastMouseReceiver=..., spontaneous=true, 
    onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2619
#51 in QWidgetWindow::handleMouseEvent (this=0x11b98d0, event=0x7fffffffc740) at kernel/qwidgetwindow.cpp:580
#52 in QWidgetWindow::event (this=0x11b98d0, event=0x7fffffffc740) at kernel/qwidgetwindow.cpp:300
#53 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x11b98d0, e=0x7fffffffc740) at kernel/qapplication.cpp:3637
#54 in QCoreApplication::notifyInternal2 (receiver=0x11b98d0, event=0x7fffffffc740) at kernel/qcoreapplication.cpp:1064
#55 in QGuiApplicationPrivate::processMouseEvent (e=0x1518ff0) at kernel/qguiapplication.cpp:2285
#56 in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#57 in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#58 in g_main_dispatch (context=0x7fffec005010) at ../glib/gmain.c:3444
#59 g_main_context_dispatch (context=context@entry=0x7fffec005010) at ../glib/gmain.c:4162
#60 in g_main_context_iterate (context=context@entry=0x7fffec005010, block=block@entry=1, dispatch=dispatch@entry=1, 
    self=<optimized out>) at ../glib/gmain.c:4238
#61 in g_main_context_iteration (context=0x7fffec005010, may_block=1) at ../glib/gmain.c:4303
#62 in QEventDispatcherGlib::processEvents (this=0xd22f20, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#63 in QEventLoop::exec (this=this@entry=0x7fffffffca70, flags=..., flags@entry=...)
    at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#64 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#65 in main (argc=1, argv=0x7fffffffd188) at /umbrello/master/umbrello/main.cpp:340
Comment 5 Oliver Kellogg 2022-12-27 05:42:31 UTC
Git commit b3bd2bf9f83cbc017dbb532e0724f8505eb567ed by Oliver Kellogg.
Committed on 27/12/2022 at 05:41.
Pushed by okellogg into branch 'master'.

Address https://bugs.kde.org/show_bug.cgi?id=462627#c4 : In umbrello/uml.cpp function slotTabChanged do not call m_doc->changeCurrentView() if m_doc->closing() returns true.

M  +1    -1    umbrello/uml.cpp

https://invent.kde.org/sdk/umbrello/commit/b3bd2bf9f83cbc017dbb532e0724f8505eb567ed