Bug 411962 - konsole crashes when closing a tab
Summary: konsole crashes when closing a tab
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 19.08.0
Platform: Debian stable Linux
: NOR crash
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords: drkonqi
: 423984 424342 425775 429486 434194 440512 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-09-16 11:33 UTC by Lukas
Modified: 2021-08-05 09:17 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 21.12


Attachments
New crash information added by DrKonqi (6.54 KB, text/plain)
2019-10-29 22:14 UTC, Grzegorz
Details
New crash information added by DrKonqi (5.79 KB, text/plain)
2019-11-16 21:41 UTC, Grzegorz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas 2019-09-16 11:33:15 UTC
Application: konsole (19.08.0)

Qt Version: 5.11.3
Frameworks Version: 5.54.0
Operating System: Linux 5.2.0-2-amd64 x86_64
Distribution: Debian GNU/Linux bullseye/sid

-- Information about the crash:
- What I was doing when the application crashed:

I pressed ctrl+shift+w to close a tab when a ssh session froze. Konsole segfaulted. Happened several times already.

-- Backtrace:
Application: Konsole (konsole), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f313f5b5800 (LWP 2573))]

Thread 4 (Thread 0x7f3136292700 (LWP 2576)):
#0  0x00007f31428d6db5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f3136748ffb in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#2  0x00007f3136748c17 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#3  0x00007f31428d0fb7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007f31453ad49f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Thread 3 (Thread 0x7f313c977700 (LWP 2575)):
#0  0x00007f31453a2edf in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f31420b6bf6 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f31420b6d1c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f3143cc53e3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f3143c72cfb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f3143ac2d8e in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f3143229545 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x00007f3143acca07 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f31428d0fb7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#9  0x00007f31453ad49f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Thread 2 (Thread 0x7f313e3bf700 (LWP 2574)):
#0  0x00007f31453a2edf in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f3142b05cf7 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007f3142b0791a in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007f313f174d79 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#4  0x00007f3143acca07 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f31428d0fb7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007f31453ad49f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Thread 1 (Thread 0x7f313f5b5800 (LWP 2573)):
[KCrash Handler]
#6  0x00007f31446286ce in QWidget::setFocus(Qt::FocusReason) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#7  0x00007f3143c9d5c0 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f31452555d2 in Konsole::TabbedViewContainer::activeViewChanged(Konsole::TerminalDisplay*) () from /usr/lib/x86_64-linux-gnu/libkonsoleprivate.so.19
#9  0x00007f314523dcd7 in Konsole::TabbedViewContainer::currentTabChanged(int) () from /usr/lib/x86_64-linux-gnu/libkonsoleprivate.so.19
#10 0x00007f3143c9d5c0 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#11 0x00007f31447ae7fe in QTabWidget::currentChanged(int) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007f31447b0bdf in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007f3143c9d463 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007f314478fc1e in QTabBar::currentChanged(int) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00007f314479423d in QTabBar::setCurrentIndex(int) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007f3143c9d5c0 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007f31445e9f42 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007f31445ec560 in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007f31445ece14 in QAction::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007f31445f0501 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007f31445f79b0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007f3143c74029 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#23 0x00007f314404ba13 in QShortcutMap::dispatchEvent(QKeyEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#24 0x00007f314404baeb in QShortcutMap::tryShortcut(QKeyEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#25 0x00007f3144000f46 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#26 0x00007f314401d4bd in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#27 0x00007f3144022e45 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#28 0x00007f3143ffd06b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#29 0x00007f313f20b39b in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#30 0x00007f3143c72cfb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#31 0x00007f3143c7acd2 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#32 0x00007f314549fe59 in kdemain () from /usr/lib/x86_64-linux-gnu/libkdeinit5_konsole.so
#33 0x00007f31452d9bbb in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#34 0x0000556741ae408a in _start ()
[Inferior 1 (process 2573) detached]

Possible duplicates by query: bug 411561, bug 410582.

Reported using DrKonqi
Comment 1 Grzegorz 2019-10-29 22:14:35 UTC
Created attachment 123578 [details]
New crash information added by DrKonqi

konsole (19.08.2) using Qt 5.13.1

I close tabs using ctrl + shift + w and konsole has beed crashed
I had frozen ssh sessions

-- Backtrace (Reduced):
#6  0x00007fb967fc918e in QWidget::setFocus(Qt::FocusReason) () from /usr/lib/libQt5Widgets.so.5
[...]
#8  0x00007fb968b8a163 in Konsole::TabbedViewContainer::activeViewChanged(Konsole::TerminalDisplay*) () from /usr/lib/libkonsoleprivate.so.19
#9  0x00007fb968c3a9bd in Konsole::TabbedViewContainer::currentTabChanged(int) () from /usr/lib/libkonsoleprivate.so.19
[...]
#11 0x00007fb9681683cf in QTabWidget::currentChanged(int) () from /usr/lib/libQt5Widgets.so.5
[...]
#14 0x00007fb9681482af in QTabBar::currentChanged(int) () from /usr/lib/libQt5Widgets.so.5
Comment 2 Grzegorz 2019-11-16 21:41:11 UTC
Created attachment 123961 [details]
New crash information added by DrKonqi

konsole (19.08.3) using Qt 5.13.2

- What I was doing when the application crashed:
if you have a frozen ssh session and close the card with the shortcut ctrl + shift + w, crash occurs

-- Backtrace (Reduced):
#6  0x00007fe7863a217e in QWidget::setFocus(Qt::FocusReason) () from /usr/lib/libQt5Widgets.so.5
[...]
#8  0x00007fe786f67163 in Konsole::TabbedViewContainer::activeViewChanged(Konsole::TerminalDisplay*) () from /usr/lib/libkonsoleprivate.so.19
#9  0x00007fe7870179ed in Konsole::TabbedViewContainer::currentTabChanged(int) () from /usr/lib/libkonsoleprivate.so.19
[...]
#11 0x00007fe78654146f in QTabWidget::currentChanged(int) () from /usr/lib/libQt5Widgets.so.5
[...]
#14 0x00007fe78652135f in QTabBar::currentChanged(int) () from /usr/lib/libQt5Widgets.so.5
Comment 3 Nate Graham 2021-08-02 18:36:29 UTC
*** Bug 429486 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2021-08-02 18:36:43 UTC
*** Bug 424342 has been marked as a duplicate of this bug. ***
Comment 5 Nate Graham 2021-08-02 18:36:56 UTC
*** Bug 425775 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2021-08-02 18:37:02 UTC
*** Bug 423984 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2021-08-02 18:37:18 UTC
*** Bug 434194 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2021-08-02 18:37:53 UTC
*** Bug 440512 has been marked as a duplicate of this bug. ***
Comment 9 Ahmad Samir 2021-08-02 21:20:40 UTC
From bug 424342:
Thread 1 (Thread 0x7f68370f6080 (LWP 3066)):
[KCrash Handler]
#6  QWidget::testAttribute (attribute=<optimized out>, this=<optimized out>) at ../../include/QtWidgets/../../src/widgets/kernel/qwidget.h:868
#7  QWidget::isEnabled (this=0x0) at ../../include/QtWidgets/../../src/widgets/kernel/qwidget.h:767
#8  QWidget::setFocus (this=0x0, reason=Qt::OtherFocusReason) at kernel/qwidget.cpp:6516
#9  0x00007f683b209458 in QtPrivate::QSlotObjectBase::call (a=0x7ffdf9b82f70, r=0x55d5ab952830, this=0x55d5ab96d730) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394
#10 QMetaObject::activate (sender=0x55d5ab9529c0, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>) at kernel/qobject.cpp:3784
#11 0x00007f683c803fb6 in Konsole::TabbedViewContainer::activeViewChanged(Konsole::TerminalDisplay*) () from /usr/lib/x86_64-linux-gnu/libkonsoleprivate.so.19
#12 0x00007f683c8b5d4d in Konsole::TabbedViewContainer::currentTabChanged(int) () from /usr/lib/x86_64-linux-gnu/libkonsoleprivate.so.19
#13 0x00007f683b209458 in QtPrivate::QSlotObjectBase::call (a=0x7ffdf9b830c0, r=0x55d5ab9529c0, this=0x55d5ab95b6e0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394
#14 QMetaObject::activate (sender=0x55d5ab9529c0, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>) at kernel/qobject.cpp:3784
#15 0x00007f683bdcdd32 in QTabWidget::currentChanged (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qtabwidget.cpp:325
#16 0x00007f683bdd0292 in QTabWidget::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at widgets/qtabwidget.h:175
#17 0x00007f683b209300 in QMetaObject::activate (sender=0x55d5ab9569c0, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>) at kernel/qobject.cpp:3804
#18 0x00007f683bdae632 in QTabBar::currentChanged (this=this@entry=0x55d5ab9569c0, _t1=<optimized out>, _t1@entry=15) at .moc/moc_qtabbar.cpp:337
#19 0x00007f683bdb2dfc in QTabBar::setCurrentIndex (this=0x55d5ab9569c0, index=15) at widgets/qtabbar.cpp:1383

and bug 440512 has a similar backtrace (the other duplicates mostly have incomplete backtraces).
Comment 10 Bug Janitor Service 2021-08-02 21:21:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/450
Comment 11 Ahmad Samir 2021-08-02 21:24:41 UTC
(So, this could be the same as bug 424342 and bug 440512, or it could a different issue, the backtrace isn't as complete, i.e. I don't see QWidget::setFocus (this=0x0, reason=Qt::OtherFocusReason) here, but I would say it's probably the same issue).
Comment 12 tcanabrava 2021-08-05 09:17:39 UTC
Git commit 39d3437df95b4fedbafa8f09d64f9c482feed551 by Tomaz  Canabrava, on behalf of Ahmad Samir.
Committed on 05/08/2021 at 09:17.
Pushed by tcanabrava into branch 'master'.

Fix crash when closing a tab using the close button

Looking at the crash backtraces from the bug reports, it seems this is what
happens, when you have two tabs open, then click the close button on the
non-current tab:
  - QTabBar::currentChanged() is emitted, the TerminalDisplay pointer is
    still not null at this point (the code checks for that)
  - TabbedViewContainer::currentTabChanged()
  - TabbedViewContainer::activeViewChanged()
  - ViewManager::activateView(), at this point the TerminalDisplay pointer
    could be null, which then crashes when we call Widget::setFocus()
FIXED-IN: 21.12

M  +6    -6    src/ViewManager.cpp

https://invent.kde.org/utilities/konsole/commit/39d3437df95b4fedbafa8f09d64f9c482feed551