Bug 420695

Summary: Dolphin crashes when closing terminal via "Close Session"
Product: [Applications] konsole Reporter: Andreas Kohlbecker <ak>
Component: kpartAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: crash CC: a.samirh78, andythe_great, arshad.husain1, ases, elvis.angelaccio, fella, jan-bugs, kde, kfm-devel, leadpogrommer, nate, sanderbartsantema2, sorelz.ff, wbauer1, yjcoshc
Priority: NOR Keywords: drkonqi
Version: 20.04.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 20.04.2
Sentry Crash Report:

Description Andreas Kohlbecker 2020-04-28 07:08:19 UTC
Application: dolphin (20.04.0)

Qt Version: 5.14.1
Frameworks Version: 5.69.0
Operating System: Linux 5.3.0-46-generic x86_64
Windowing system: X11
Distribution: KDE neon User Edition 5.18

-- Information about the crash:
To reproduce:

1. Open the terminal pane in dolphin
2. Attempt to close it vi the terminal context menu (right klick in terminal > "Close Session")

This will crash Dolphin reliably

Dolphin does not crash when the Teriminal is closed via the tool bar button.

The crash can be reproduced sometimes.

-- Backtrace:
Application: Dolphin (dolphin), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f645265d800 (LWP 1050))]

Thread 4 (Thread 0x7f642199a700 (LWP 1054)):
#0  0x00007f6451ed10b4 in __GI___libc_read (fd=18, buf=0x7f6421999b90, nbytes=16) at ../sysdeps/unix/sysv/linux/read.c:27
#1  0x00007f644399f2b0 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f644395a0b7 in g_main_context_check () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f644395a570 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f644395a6dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f644ba840db in QEventDispatcherGlib::processEvents (this=0x7f641c000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#6  0x00007f644ba2363a in QEventLoop::exec (this=this@entry=0x7f6421999da0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225
#7  0x00007f644b834317 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:536
#8  0x00007f644b8357ec in QThreadPrivate::start (arg=0x55b4fae273d0) at thread/qthread_unix.cpp:342
#9  0x00007f6445d446db in start_thread (arg=0x7f642199a700) at pthread_create.c:463
#10 0x00007f6451ee288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7f642ab3b700 (LWP 1053)):
#0  0x00007f6445d4a9f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55b4faaf9348) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x55b4faaf92f8, cond=0x55b4faaf9320) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x55b4faaf9320, mutex=0x55b4faaf92f8) at pthread_cond_wait.c:655
#3  0x00007f642b63decb in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#4  0x00007f642b63dac7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#5  0x00007f6445d446db in start_thread (arg=0x7f642ab3b700) at pthread_create.c:463
#6  0x00007f6451ee288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f6433557700 (LWP 1052)):
#0  0x00007f6451ed5bf9 in __GI___poll (fds=0x7f642c011f40, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f644395a5c9 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f644395a6dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f644ba840db in QEventDispatcherGlib::processEvents (this=0x7f642c000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#4  0x00007f644ba2363a in QEventLoop::exec (this=this@entry=0x7f6433556d70, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225
#5  0x00007f644b834317 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:536
#6  0x00007f644bf10555 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x00007f644b8357ec in QThreadPrivate::start (arg=0x7f644c188da0) at thread/qthread_unix.cpp:342
#8  0x00007f6445d446db in start_thread (arg=0x7f6433557700) at pthread_create.c:463
#9  0x00007f6451ee288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f645265d800 (LWP 1050)):
[KCrash Handler]
#6  0x00007f644cdd9c03 in QListData::size (this=0x55b4fb0d2088) at ../../include/QtCore/../../src/corelib/tools/qlist.h:917
#7  QtPrivate::indexOf<QAction*, QAction*> (from=0, u=@0x7ffebf886528: 0x55b4fb0ccd80, list=...) at ../../include/QtCore/../../src/corelib/tools/qlist.h:1021
#8  QList<QAction*>::indexOf (from=0, t=@0x7ffebf886528: 0x55b4fb0ccd80, this=0x55b4fb0d2088) at ../../include/QtCore/../../src/corelib/tools/qlist.h:1009
#9  QList<QAction*>::removeAll (this=0x55b4fb0d2088, _t=@0x7ffebf886528: 0x55b4fb0ccd80) at ../../include/QtCore/../../src/corelib/tools/qlist.h:919
#10 0x00007f644ce13457 in QWidget::removeAction (this=0x55b4fb099530, action=<optimized out>) at kernel/qwidget.cpp:3173
#11 0x00007f644f44d519 in KActionCollection::removeAssociatedWidget(QWidget*) () from /usr/lib/x86_64-linux-gnu/libKF5XmlGui.so.5
#12 0x00007f644f49690b in KXMLGUIClient::prepareXMLUnplug(QWidget*) () from /usr/lib/x86_64-linux-gnu/libKF5XmlGui.so.5
#13 0x00007f644f49b0a1 in KXMLGUIFactory::removeClient(KXMLGUIClient*) () from /usr/lib/x86_64-linux-gnu/libKF5XmlGui.so.5
#14 0x00007f64208d3614 in Konsole::SessionController::~SessionController() () from /usr/lib/x86_64-linux-gnu/libkonsoleprivate.so.20
#15 0x00007f64208d37c9 in Konsole::SessionController::~SessionController() () from /usr/lib/x86_64-linux-gnu/libkonsoleprivate.so.20
#16 0x00007f644ba57eb5 in QObject::event (this=0x55b4faff71e0, e=0x55b4fb0ffb20) at kernel/qobject.cpp:1326
#17 0x00007f644cddb8bc in QApplicationPrivate::notify_helper (this=this@entry=0x55b4fa935090, receiver=receiver@entry=0x55b4faff71e0, e=e@entry=0x55b4fb0ffb20) at kernel/qapplication.cpp:3684
#18 0x00007f644cde2ac0 in QApplication::notify (this=0x7ffebf886d80, receiver=0x55b4faff71e0, e=0x55b4fb0ffb20) at kernel/qapplication.cpp:3430
#19 0x00007f644ba24db8 in QCoreApplication::notifyInternal2 (receiver=0x55b4faff71e0, event=0x55b4fb0ffb20) at kernel/qcoreapplication.cpp:1092
#20 0x00007f644ba24f8e in QCoreApplication::sendEvent (receiver=receiver@entry=0x55b4faff71e0, event=event@entry=0x55b4fb0ffb20) at kernel/qcoreapplication.cpp:1487
#21 0x00007f644ba27a31 in QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x55b4fa92ac00) at kernel/qcoreapplication.cpp:1832
#22 0x00007f644ba27fc8 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1691
#23 0x00007f644ba84a13 in postEventSourceDispatch (s=0x55b4fa985bf0) at kernel/qeventdispatcher_glib.cpp:277
#24 0x00007f644395a417 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007f644395a650 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007f644395a6dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007f644ba840bc in QEventDispatcherGlib::processEvents (this=0x55b4fa995720, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#28 0x00007f644ba2363a in QEventLoop::exec (this=this@entry=0x7ffebf886c90, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225
#29 0x00007f644ba2cdb0 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1400
#30 0x00007f64521f97c5 in kdemain () from /usr/lib/x86_64-linux-gnu/libkdeinit5_dolphin.so
#31 0x00007f6451de2b97 in __libc_start_main (main=0x55b4fa04d720, argc=1, argv=0x7ffebf886ef8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffebf886ee8) at ../csu/libc-start.c:310
#32 0x000055b4fa04d75a in _start ()

Possible duplicates by query: bug 404702, bug 398382, bug 394191, bug 392629, bug 387275.

Reported using DrKonqi
Comment 1 Colin J Thomson 2020-04-30 18:54:55 UTC
*** Bug 420810 has been marked as a duplicate of this bug. ***
Comment 2 arshad.husain1@gmail.com 2020-05-01 09:48:54 UTC
I apologize but I can't seem to replicate this bug. I have the same KF5 version and the same distro but my Qt5 version is 5.14.2. I have a hunch that whatever it was that was causing this issue was fixed in Qt 5.14.2.
Comment 3 Colin J Thomson 2020-05-01 21:36:49 UTC
FYI I have the same KF5 version but my my Qt Version is 5.13.2 on this F32 box and I can produce the same crash 99% of the time.
Comment 4 kde 2020-05-01 22:57:32 UTC
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.1

I can also reliably crash Dolphin by right-clicking the terminal window and selecting close or hitting Ctrl-Shift-W. Hitting Ctrl-D also makes it crash.
Comment 5 Tobias Fella 2020-05-02 22:03:50 UTC
(In reply to arshad.husain1@gmail.com from comment #2)
> I apologize but I can't seem to replicate this bug. I have the same KF5
> version and the same distro but my Qt5 version is 5.14.2. I have a hunch
> that whatever it was that was causing this issue was fixed in Qt 5.14.2.

I can reproduce it in 5.14.2, so it's not fixed. I'm currently looking into it.
Comment 6 Elvis Angelaccio 2020-05-03 16:40:28 UTC
Valgrind log:

Invalid read of size 8
==10778==    at 0x73C3881: ??? (in /usr/lib/libQt5Core.so.5.15.0)
==10778==    by 0x73C43BD: QObject::disconnect(QObject const*, char const*, QObject const*, char const*) (in /usr/lib/libQt5Core.so.5.15.0)
==10778==    by 0x5347CA0: KActionCollection::removeAssociatedWidget(QWidget*) (dev/kde/kxmlgui/src/kactioncollection.cpp:834)
==10778==    by 0x53B24A9: KXMLGUIClient::prepareXMLUnplug(QWidget*) (dev/kde/kxmlgui/src/kxmlguiclient.cpp:796)
==10778==    by 0x53B5DFD: KXMLGUIFactory::removeClient(KXMLGUIClient*) (dev/kde/kxmlgui/src/kxmlguifactory.cpp:464)
==10778==    by 0x1B16A052: Konsole::SessionController::~SessionController() (in /usr/lib/libkonsoleprivate.so.20.04.0)
==10778==    by 0x1B16A2A9: Konsole::SessionController::~SessionController() (in /usr/lib/libkonsoleprivate.so.20.04.0)
==10778==    by 0x73C26CF: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.15.0)
==10778==    by 0x63D7391: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.15.0)
==10778==    by 0x63E05A8: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.15.0)
==10778==    by 0x7395379: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.15.0)
==10778==    by 0x7397CE2: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/libQt5Core.so.5.15.0)
==10778==  Address 0x19434230 is 64 bytes inside a block of size 440 free'd
==10778==    at 0x483B08B: operator delete(void*, unsigned long) (vg_replace_malloc.c:595)
==10778==    by 0x73C9DF1: QObject::~QObject() (in /usr/lib/libQt5Core.so.5.15.0)
==10778==    by 0x6416739: QWidget::~QWidget() (in /usr/lib/libQt5Widgets.so.5.15.0)
==10778==    by 0x1B179159: Konsole::TerminalDisplay::~TerminalDisplay() (in /usr/lib/libkonsoleprivate.so.20.04.0)
==10778==    by 0x73C26CF: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.15.0)
==10778==    by 0x641AE68: QWidget::event(QEvent*) (in /usr/lib/libQt5Widgets.so.5.15.0)
==10778==    by 0x63D7391: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.15.0)
==10778==    by 0x63E05A8: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.15.0)
==10778==    by 0x7395379: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.15.0)
==10778==    by 0x7397CE2: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/libQt5Core.so.5.15.0)
==10778==    by 0x73EF983: ??? (in /usr/lib/libQt5Core.so.5.15.0)
==10778==    by 0x92396BD: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.6400.2)
==10778==  Block was alloc'd at
==10778==    at 0x4839DEF: operator new(unsigned long) (vg_replace_malloc.c:344)
==10778==    by 0x641CA5D: QWidget::QWidget(QWidget*, QFlags<Qt::WindowType>) (in /usr/lib/libQt5Widgets.so.5.15.0)
==10778==    by 0x1B17C438: Konsole::TerminalDisplay::TerminalDisplay(QWidget*) (in /usr/lib/libkonsoleprivate.so.20.04.0)
==10778==    by 0x1B195098: Konsole::ViewManager::createTerminalDisplay(Konsole::Session*) (in /usr/lib/libkonsoleprivate.so.20.04.0)
==10778==    by 0x1B197670: Konsole::ViewManager::createView(Konsole::Session*) (in /usr/lib/libkonsoleprivate.so.20.04.0)
==10778==    by 0x1A61C6BE: ??? (in /usr/lib/qt/plugins/konsolepart.so)
==10778==    by 0x1A61D18A: ??? (in /usr/lib/qt/plugins/konsolepart.so)
==10778==    by 0x1A61E532: ??? (in /usr/lib/qt/plugins/konsolepart.so)
==10778==    by 0x704A12D: KPluginFactory::create(char const*, QWidget*, QObject*, QList<QVariant> const&, QString const&) (dev/kde/kcoreaddons/src/lib/plugin/kpluginfactory.cpp:133)
==10778==    by 0x4905E17: KParts::ReadOnlyPart* KPluginFactory::create<KParts::ReadOnlyPart>(QObject*, QList<QVariant> const&) (install/include/KF5/KCoreAddons/kpluginfactory.h:545)
==10778==    by 0x49041E1: TerminalPanel::showEvent(QShowEvent*) (terminalpanel.cpp:151)
==10778==    by 0x641AEBD: QWidget::event(QEvent*) (in /usr/lib/libQt5Widgets.so.5.15.0)

moving to konsole.
Comment 7 Elvis Angelaccio 2020-05-03 17:15:46 UTC
*** Bug 420647 has been marked as a duplicate of this bug. ***
Comment 8 Ahmad Samir 2020-05-11 16:36:21 UTC
Might be related to bug 420820, could you try upgrading to KF 5.70 (KBookmarks specifically)? It's been released a couple of days ago.
Comment 9 Colin J Thomson 2020-05-11 17:10:49 UTC
Still seeing the crash with frameworks 5.70, FYI Dolphin Version 20.04.0
Comment 10 Elvis Angelaccio 2020-05-11 17:20:02 UTC
(In reply to Ahmad Samir from comment #8)
> Might be related to bug 420820, could you try upgrading to KF 5.70
> (KBookmarks specifically)? It's been released a couple of days ago.

I have kbookmarks at commit 2fbb2ff9b6 and I could reproduce the crash.
Comment 11 Ahmad Samir 2020-05-11 19:37:26 UTC
(In reply to Elvis Angelaccio from comment #10)
> (In reply to Ahmad Samir from comment #8)
> > Might be related to bug 420820, could you try upgrading to KF 5.70
> > (KBookmarks specifically)? It's been released a couple of days ago.
> 
> I have kbookmarks at commit 2fbb2ff9b6 and I could reproduce the crash.

The fix from the bug I mentioned was in commit 5603e1252251a23bca0 which was pushed to 5.70.0 tag AFAICS.

https://commits.kde.org/kbookmarks/5603e1252251a23bca0f2cc48b9310d9bdfdfee7

I tested on Tumbleweed, which has recent-ish git master checkouts, I don't get a crash... but then again that issue was/is complicated.
Comment 12 Elvis Angelaccio 2020-05-17 22:01:16 UTC
Tried again with 5603e1252251a23bca0f2cc48b9310d9bdfdfee7 applied, still crashes :(
Comment 13 Juan Ases GarcĂ­a 2020-05-18 22:25:50 UTC
Probably related to the same underlying bug affecting Yakuake Bug #415762
Comment 15 JanKusanagi 2020-05-30 15:22:22 UTC
(In reply to Wolfgang Bauer from comment #14)
> Should be fixed by either
> https://invent.kde.org/utilities/konsole/-/commit/
> 76f3764b47985f5fe50532d46b2e043ba8e31e4a or
> https://invent.kde.org/utilities/konsole/-/commit/
> d40e3c72f2ad9262d6028bc62bc2837067b824a0 .

Mageia applied both patches and I can confirm that I can't crash neither Yakuake nor Dolphin's terminal the way I used to. THANKS!
Comment 16 Christoph Feck 2020-07-05 13:10:28 UTC
*** Bug 422767 has been marked as a duplicate of this bug. ***