Bug 426939 - Kate sometimes crashes when showing previously-hidden menu bar
Summary: Kate sometimes crashes when showing previously-hidden menu bar
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 20.08.1
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2020-09-25 02:33 UTC by S. Christian Collins
Modified: 2021-06-12 21:33 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description S. Christian Collins 2020-09-25 02:33:17 UTC
Application: kate (20.08.1)

Qt Version: 5.15.0
Frameworks Version: 5.74.0
Operating System: Linux 5.4.67-xanmod1 x86_64
Windowing system: X11
Distribution: KDE neon User Edition 5.19

-- Information about the crash:
- What I was doing when the application crashed: I came back to my computer after a long period of inactivity, clicked on my open Kate window which had some notes in the default "untitled" document. I then pressed Ctrl-M to show the menu bar, which had previously been hidden. That is when Kate crashed. This also happened to me the other day in a similar situation (Kate had been open a long time, came back to computer, Ctrl-M to show menu bar). These two instances are the only times thus far where I have encountered the crash. Ctrl-M in Kate usually functions without issue for me.

The crash can be reproduced sometimes.

-- Backtrace:
Application: Kate (kate), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f86edb108e6 in qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > > (ptr=...) at kernel/qwidget.cpp:3161
#5  QWidget::d_func (this=<optimized out>) at ../../include/QtWidgets/../../src/widgets/kernel/qwidget.h:132
#6  QWidget::removeAction (this=0x0, action=0x556f8c9a5250) at kernel/qwidget.cpp:3164
#7  0x0000556f8aea2250 in KateMainWindow::toggleShowMenuBar (this=0x556f8c9248b0, showMessage=showMessage@entry=true) at ./kate/katemainwindow.cpp:652
#8  0x0000556f8aeda666 in KateMainWindow::qt_static_metacall (_o=0x556f8c9248b0, _c=<optimized out>, _id=<optimized out>, _a=0x7ffe99ffad40) at ./obj-x86_64-linux-gnu/kate/kate-lib_autogen/EWIEGA46WW/moc_katemainwindow.cpp:428
#9  0x00007f86ecf705e0 in doActivate<false> (sender=0x556f8c9a5250, signal_index=4, argv=0x7ffe99ffad40) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:395
#10 0x00007f86ecf69977 in QMetaObject::activate (sender=sender@entry=0x556f8c9a5250, m=m@entry=0x7f86edfe7280 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7ffe99ffad40) at kernel/qobject.cpp:3946
#11 0x00007f86edad07f6 in QAction::triggered (this=this@entry=0x556f8c9a5250, _t1=<optimized out>) at .moc/moc_qaction.cpp:376
#12 0x00007f86edad2ec8 in QAction::activate (this=0x556f8c9a5250, event=<optimized out>) at kernel/qaction.cpp:1161
#13 0x00007f86edad37df in QAction::event (e=<optimized out>, this=<optimized out>) at kernel/qaction.cpp:1086
#14 QAction::event (this=<optimized out>, e=<optimized out>) at kernel/qaction.cpp:1075
#15 0x00007f86edad6cc3 in QApplicationPrivate::notify_helper (this=this@entry=0x556f8c703860, receiver=receiver@entry=0x556f8c9a5250, e=e@entry=0x7ffe99ffb0c0) at kernel/qapplication.cpp:3671
#16 0x00007f86edadfc70 in QApplication::notify (this=0x7ffe99ffb780, receiver=0x556f8c9a5250, e=0x7ffe99ffb0c0) at kernel/qapplication.cpp:3417
#17 0x00007f86ecf396aa in QCoreApplication::notifyInternal2 (receiver=0x556f8c9a5250, event=0x7ffe99ffb0c0) at ../../include/QtCore/5.15.0/QtCore/private/../../../../../src/corelib/thread/qthread_p.h:325
#18 0x00007f86ed397653 in QShortcutMap::dispatchEvent (this=this@entry=0x556f8c703928, e=e@entry=0x7ffe99ffb180) at kernel/qshortcutmap.cpp:675
#19 0x00007f86ed397ff3 in QShortcutMap::tryShortcut (this=this@entry=0x556f8c703928, e=e@entry=0x7ffe99ffb180) at kernel/qshortcutmap.cpp:343
#20 0x00007f86ed3457a2 in QWindowSystemInterface::handleShortcutEvent (window=<optimized out>, window@entry=0x556f8d70a510, timestamp=40008198, keyCode=77, modifiers=..., nativeScanCode=58, nativeVirtualKey=109, nativeModifiers=20, text=..., autorepeat=false, count=1) at kernel/qwindowsysteminterface.cpp:478
#21 0x00007f86ed365311 in QGuiApplicationPrivate::processKeyEvent (e=e@entry=0x7f86e0014980) at kernel/qguiapplication.cpp:2327
#22 0x00007f86ed36a59b in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0x7f86e0014980) at kernel/qguiapplication.cpp:1952
#23 0x00007f86ed3422cb in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1175
#24 0x00007f86e84a599e in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#25 0x00007f86ead6dfbd in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007f86ead6e240 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007f86ead6e2e3 in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007f86ecf93e92 in QEventDispatcherGlib::processEvents (this=0x556f8c76fcf0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#29 0x00007f86ecf381bb in QEventLoop::exec (this=this@entry=0x7ffe99ffb530, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:141
#30 0x00007f86ecf40354 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#31 0x0000556f8ae90d77 in main (argc=<optimized out>, argv=<optimized out>) at ./kate/main.cpp:638
[Inferior 1 (process 7838) detached]

Possible duplicates by query: bug 421424, bug 416099, bug 405834, bug 387233, bug 374792.

Reported using DrKonqi
Comment 1 Christoph Cullmann 2021-06-12 21:33:42 UTC
Git commit 3a5cd56981f76138fa80f6ecffede2abcfdab766 by Christoph Cullmann.
Committed on 12/06/2021 at 21:33.
Pushed by cullmann into branch 'master'.

ensure to not crash on missing context menu

contextMenu() is allowed to return a nullptr

check for this to avoid crash on menubar hide/show

see backtrace in related bug, nullptr as menu

M  +6    -16   kate/katemainwindow.cpp
M  +0    -3    kate/katemainwindow.h
M  +6    -12   kwrite/kwrite.cpp
M  +0    -3    kwrite/kwrite.h

https://invent.kde.org/utilities/kate/commit/3a5cd56981f76138fa80f6ecffede2abcfdab766