Bug 483973 - KCacheGrind crashes when opening history menu
Summary: KCacheGrind crashes when opening history menu
Status: RESOLVED FIXED
Alias: None
Product: kcachegrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 24.02.0
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Josef Weidendorfer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-19 07:21 UTC by Quinten Kock
Modified: 2024-05-12 16:34 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Quinten Kock 2024-03-19 07:21:51 UTC
SUMMARY
When opening the history menu in KCacheGrind (to navigate between functions, the Back on the toolbar), it crashes.


STEPS TO REPRODUCE
1. Open a file
2. Change the viewed function
3. Click the arrow next to Back in the toolbar

OBSERVED RESULT
Crash

EXPECTED RESULT
A nice history of what functions I've looked at

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
Comment 1 Quinten Kock 2024-03-19 07:44:38 UTC
Backtrace from the segfaulted thread. It seems to be clearing a NULL menu:

Thread 1 (Thread 0x7ffff1a1d9c0 (LWP 112356) "kcachegrind"):
#0  QMenu::clear (this=this@entry=0x0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/widgets/qmenu.cpp:2220
        acts = {<QListSpecialMethods<QAction*>> = {<QListSpecialMethodsBase<QAction*>> = {<No data fields>}, <No data fields>}, d = {d = 0x55555568e700, ptr = 0x7ffff7158d06 <QWidgetWindow::event(QEvent*)+502>, size = 140737488340400}}
#1  0x000055555558985e in TopLevel::backAboutToShow (this=0x55555584d100) at /usr/src/debug/kcachegrind/kcachegrind-24.02.0/kcachegrind/toplevel.cpp:2127
#2  0x00007ffff6190ca9 in QtPrivate::QSlotObjectBase::call (a=0x7fffffffc688, r=0x55555584d100, this=0x5555559e9540, this=<optimized out>, r=<optimized out>, a=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobjectdefs_impl.h:433
#3  doActivate<false> (sender=0x5555559aa340, signal_index=7, argv=0x7fffffffc688) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobject.cpp:4039
#4  0x00007ffff72b6545 in QMenu::aboutToShow (this=0x5555559aa340) at /usr/src/debug/qt6-base/build/src/widgets/Widgets_autogen/include/moc_qmenu.cpp:352
#5  QMenuPrivate::popup(QPoint const&, QAction*, std::function<QPoint (QSize const&)>) (this=this@entry=0x5555559edce0, p=..., atAction=atAction@entry=0x0, positionFunction=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/widgets/qmenu.cpp:2368
#6  0x00007ffff72b73e0 in QMenuPrivate::exec(QPoint const&, QAction*, std::function<QPoint (QSize const&)>) (this=0x5555559edce0, p=..., action=0x0, positionFunction=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/widgets/qmenu.cpp:2655
#7  0x00007ffff732a5df in QToolButtonPrivate::popupTimerDone (this=0x555555dbd1c0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/widgets/qtoolbutton.cpp:776
#8  0x00007ffff732a9fa in QToolButton::showMenu (this=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/widgets/qtoolbutton.cpp:667
#9  0x00007ffff732acc2 in QToolButton::mousePressEvent (this=0x555555d6a9e0, e=0x7fffffffcef0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/widgets/qtoolbutton.cpp:569
#10 0x00007ffff7144fb2 in QWidget::event (this=0x555555d6a9e0, event=0x7fffffffcef0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qwidget.cpp:8955
#11 0x00007ffff70f438b in QApplicationPrivate::notify_helper (this=this@entry=0x55555568f0a0, receiver=receiver@entry=0x555555d6a9e0, e=e@entry=0x7fffffffcef0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:3296
#12 0x00007ffff70f6be8 in QApplication::notify (this=<optimized out>, receiver=0x555555d6a9e0, e=0x7fffffffcef0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:2782
#13 0x00007ffff6139818 in QCoreApplication::notifyInternal2 (receiver=0x555555d6a9e0, event=0x7fffffffcef0) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1121
#14 0x00007ffff613986d in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1553
#15 0x00007ffff70f2327 in QApplicationPrivate::sendMouseEvent (receiver=0x555555d6a9e0, event=0x7fffffffcef0, alienWidget=0x555555d6a9e0, nativeWidget=0x55555584d100, buttonDown=<optimized out>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:2366
#16 0x00007ffff7157a97 in QWidgetWindow::handleMouseEvent (this=0x555555847a00, event=event@entry=0x7fffffffd260) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qwidgetwindow.cpp:653
#17 0x00007ffff7158db0 in QWidgetWindow::event (this=0x555555847a00, event=0x7fffffffd260) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qwidgetwindow.cpp:267
#18 0x00007ffff70f438b in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x555555847a00, e=0x7fffffffd260) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:3296
#19 0x00007ffff6139818 in QCoreApplication::notifyInternal2 (receiver=0x555555847a00, event=0x7fffffffd260) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1121
#20 0x00007ffff613986d in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1553
#21 0x00007ffff676f9e5 in QGuiApplicationPrivate::processMouseEvent (e=0x55555630e110) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/gui/kernel/qguiapplication.cpp:2325
#22 0x00007ffff67da85c in QWindowSystemInterface::sendWindowSystemEvents (flags=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/gui/kernel/qwindowsysteminterface.cpp:1109
#23 0x00007ffff6bb26c4 in userEventSourceDispatch (source=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/gui/platform/unix/qeventdispatcher_glib.cpp:38
#24 0x00007ffff54c6f69 in g_main_dispatch (context=0x7fffec000ef0) at ../glib/glib/gmain.c:3476
#25 0x00007ffff55253a7 in g_main_context_dispatch_unlocked (context=0x7fffec000ef0) at ../glib/glib/gmain.c:4284
#26 g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7fffec000ef0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4349
#27 0x00007ffff54c5162 in g_main_context_iteration (context=0x7fffec000ef0, may_block=1) at ../glib/glib/gmain.c:4414
#28 0x00007ffff63739c4 in QEventDispatcherGlib::processEvents (this=0x5555556cc6b0, flags=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventdispatcher_glib.cpp:393
#29 0x00007ffff6143d6e in QEventLoop::processEvents (flags=..., this=0x7fffffffd720) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventloop.cpp:100
#30 QEventLoop::exec (this=0x7fffffffd720, flags=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventloop.cpp:182
#31 0x00007ffff613c2b8 in QCoreApplication::exec () at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/global/qflags.h:74
#32 0x00007ffff70f0f0a in QApplication::exec () at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:2574
#33 0x000055555557bbc9 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kcachegrind/kcachegrind-24.02.0/kcachegrind/main.cpp:90
Comment 2 teadrinkingprogrammer 2024-03-19 22:32:37 UTC
Hi there, thank you for submitting this bug.

Could you include your Linux distribution in the metadata and provide the distribution version number?
Comment 3 Quinten Kock 2024-03-20 10:22:29 UTC
The backtrace is from my Arch Linux system, but I can also reproduce from Gentoo. Both the repo version and kdesrc-build seem to suffer from the issue.

It's probably a regression from the Qt6 upgrade, because I think it used to work.
Comment 4 Bug Janitor Service 2024-03-30 13:17:47 UTC
A possibly relevant merge request was started @ https://invent.kde.org/sdk/kcachegrind/-/merge_requests/28
Comment 5 Albert Astals Cid 2024-04-01 09:43:04 UTC
Git commit 2dfd6e65f3422fa9dc2c85a2e21be0884ee95ab2 by Albert Astals Cid, on behalf of Quinten Kock.
Committed on 01/04/2024 at 09:43.
Pushed by aacid into branch 'master'.

Fix crash when opening the back/forward/up action menus

The popup menu for back/forward/up on the toolbar crashes KCacheGrind
when KF6 is used.

It seems the KToolBarPopupAction widget changed in KF6, and menu()
is now null() by default, and we should use popupMenu() instead.

See also:
https://api.kde.org/frameworks/kwidgetsaddons/html/classKToolBarPopupAction.html

M  +3    -3    kcachegrind/toplevel.cpp

https://invent.kde.org/sdk/kcachegrind/-/commit/2dfd6e65f3422fa9dc2c85a2e21be0884ee95ab2
Comment 6 Albert Astals Cid 2024-04-01 09:43:35 UTC
Git commit bb9982b3a0300a92e8b252ef0439e1cdbc017faf by Albert Astals Cid, on behalf of Quinten Kock.
Committed on 01/04/2024 at 09:43.
Pushed by aacid into branch 'release/24.02'.

Fix crash when opening the back/forward/up action menus

The popup menu for back/forward/up on the toolbar crashes KCacheGrind
when KF6 is used.

It seems the KToolBarPopupAction widget changed in KF6, and menu()
is now null() by default, and we should use popupMenu() instead.

See also:
https://api.kde.org/frameworks/kwidgetsaddons/html/classKToolBarPopupAction.html
(cherry picked from commit 2dfd6e65f3422fa9dc2c85a2e21be0884ee95ab2)

M  +3    -3    kcachegrind/toplevel.cpp

https://invent.kde.org/sdk/kcachegrind/-/commit/bb9982b3a0300a92e8b252ef0439e1cdbc017faf