Bug 472507

Summary: Kate crashes when attempting to move "Diagnostics" button from 'Bottom of the Screen' to 'Right Side of the Screen'
Product: [Applications] kate Reporter: rxsilva
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: christoph
Priority: NOR Keywords: drkonqi
Version First Reported In: 23.04.2   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 23.08.0
Sentry Crash Report:

Description rxsilva 2023-07-22 18:31:10 UTC
Application: kate (23.04.2)

Qt Version: 5.15.10
Frameworks Version: 5.108.0
Operating System: Linux 6.3.12-200.fc38.x86_64 x86_64
Windowing System: X11
Distribution: Fedora Linux 38 (Workstation Edition)
DrKonqi: 5.27.6 [KCrashBackend]

-- Information about the crash:
Whenever I "right-click" on the "Diagnostics" button and select the "Right Side" option, Kate crashes.
However :
*  1  *   I have NOT tried any other option.  Only the "Right Side" one.
*  2  *   I can move the "Output" button to the "Right Side" of the screen by right-clicking on the button.  So, the "Output" button does NOT trigger any unusual behaviour.
*  3  *   I recently upgraded this system from Fedora 36 to Fedora 38 ( two, maybe three days ago )
*  4  *   After the upgrade, the system showed problems.  Some pretty severe.  I tracked those to Virtual Box 6.1.  Upgraded to Virtual Box 7.0 and things improved a lot, but not 
every bug went away.
*  5  *   Finally, I removed Virtual Box for good.  I haven't seen any problems yet, but, that was yesterday.  So, still testing how it goes.

The crash can be reproduced every time.

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

[KCrash Handler]
#4  0x00007f0491334e43 in DiagnosticsView::showEvent(QShowEvent*) () from /lib64/libkateprivate.so.23.04.2
#5  0x00007f04909f3688 in QWidget::event(QEvent*) () from /lib64/libQt5Widgets.so.5
#6  0x00007f04909aeb75 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#7  0x00007f048fcb4188 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#8  0x00007f04909f004d in QWidgetPrivate::show_helper() () from /lib64/libQt5Widgets.so.5
#9  0x00007f04909f312d in QWidgetPrivate::setVisible(bool) () from /lib64/libQt5Widgets.so.5
#10 0x00007f04909eff89 in QWidgetPrivate::showChildren(bool) () from /lib64/libQt5Widgets.so.5
#11 0x00007f04909f0027 in QWidgetPrivate::show_helper() () from /lib64/libQt5Widgets.so.5
#12 0x00007f04909effa9 in QWidgetPrivate::showChildren(bool) () from /lib64/libQt5Widgets.so.5
#13 0x00007f04909f0027 in QWidgetPrivate::show_helper() () from /lib64/libQt5Widgets.so.5
#14 0x00007f04909effa9 in QWidgetPrivate::showChildren(bool) () from /lib64/libQt5Widgets.so.5
#15 0x00007f04909f0027 in QWidgetPrivate::show_helper() () from /lib64/libQt5Widgets.so.5
#16 0x00007f04909f312d in QWidgetPrivate::setVisible(bool) () from /lib64/libQt5Widgets.so.5
#17 0x00007f04913127aa in KateMDI::Sidebar::showToolView(KateMDI::ToolView*) () from /lib64/libkateprivate.so.23.04.2
#18 0x00007f048fce8461 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#19 0x00007f0490b3d6c4 in QMenu::triggered(QAction*) () from /lib64/libQt5Widgets.so.5
#20 0x00007f0490b478eb in QMenuPrivate::_q_actionTriggered() () from /lib64/libQt5Widgets.so.5
#21 0x00007f048fce85e8 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt5Core.so.5
#22 0x00007f04909a7d24 in QAction::triggered(bool) () from /lib64/libQt5Widgets.so.5
#23 0x00007f04909aab7b in QAction::activate(QAction::ActionEvent) () from /lib64/libQt5Widgets.so.5
#24 0x00007f0490b3f432 in QMenuPrivate::activateCausedStack(QVector<QPointer<QWidget> > const&, QAction*, QAction::ActionEvent, bool) () from /lib64/libQt5Widgets.so.5
#25 0x00007f0490b473c2 in QMenuPrivate::activateAction(QAction*, QAction::ActionEvent, bool) () from /lib64/libQt5Widgets.so.5
#26 0x00007f04909f3688 in QWidget::event(QEvent*) () from /lib64/libQt5Widgets.so.5
#27 0x00007f04909aeb75 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#28 0x00007f04909b7456 in QApplication::notify(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#29 0x00007f048fcb4188 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#30 0x00007f04909b56a4 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /lib64/libQt5Widgets.so.5
#31 0x00007f0490a0dd42 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () from /lib64/libQt5Widgets.so.5
#32 0x00007f0490a1072f in QWidgetWindow::event(QEvent*) () from /lib64/libQt5Widgets.so.5
#33 0x00007f04909aeb75 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#34 0x00007f048fcb4188 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#35 0x00007f049016cc6b in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /lib64/libQt5Gui.so.5
#36 0x00007f049014acfc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Gui.so.5
#37 0x00007f047cf144d6 in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQt5XcbQpa.so.5
#38 0x00007f048d50f48c in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#39 0x00007f048d56d648 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0
#40 0x00007f048d50cb13 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#41 0x00007f048fd06729 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#42 0x00007f048fcb2b4b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#43 0x00007f0490b44d2e in QMenuPrivate::exec(QPoint const&, QAction*, std::function<QPoint (QSize const&)>) () from /lib64/libQt5Widgets.so.5
#44 0x00007f0490b44e56 in QMenu::exec(QPoint const&, QAction*) () from /lib64/libQt5Widgets.so.5
#45 0x00007f049131227e in KateMDI::Sidebar::eventFilter(QObject*, QEvent*) () from /lib64/libkateprivate.so.23.04.2
#46 0x00007f048fcb3f36 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#47 0x00007f04909aeb65 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#48 0x00007f04909b7998 in QApplication::notify(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#49 0x00007f048fcb4188 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#50 0x00007f0490a0d965 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () from /lib64/libQt5Widgets.so.5
#51 0x00007f0490a1072f in QWidgetWindow::event(QEvent*) () from /lib64/libQt5Widgets.so.5
#52 0x00007f04909aeb75 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
#53 0x00007f048fcb4188 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5
#54 0x00007f049016cc6b in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /lib64/libQt5Gui.so.5
#55 0x00007f049014acfc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Gui.so.5
#56 0x00007f047cf144d6 in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQt5XcbQpa.so.5
#57 0x00007f048d50f48c in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#58 0x00007f048d56d648 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0
#59 0x00007f048d50cb13 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#60 0x00007f048fd06729 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#61 0x00007f048fcb2b4b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5
#62 0x00007f048fcbaddb in QCoreApplication::exec() () from /lib64/libQt5Core.so.5
#63 0x00005648b6bf73e7 in main ()
[Inferior 1 (process 3842) detached]

Reported using DrKonqi
Comment 1 Christoph Cullmann 2023-07-22 20:17:12 UTC
The tab overlay via 

QWidget *tabForToolView(QWidget *view, KTextEditor::MainWindow *mainWindow) {
    QWidget *tab = nullptr;
    QMetaObject::invokeMethod(mainWindow->parent(), "tabForToolView", Qt::DirectConnection, Q_RETURN_ARG(QWidget *, tab), Q_ARG(QWidget *, view));
    return tab;
}

That is deleted on move and then we use invalid pointers.
Comment 2 Christoph Cullmann 2023-07-31 06:14:17 UTC
Fixed in master and backported to 23.08, thanks for reporting this issue.