SUMMARY Ui crashes when you close down the 'get more templates' when creating a file STEPS TO REPRODUCE 1. Right click on any folder 2. hit 'Create From Template' 3. Hit 'Get more templates...' 4. wait for dialog to load 5. Hit X on top right of more templates dialog OBSERVED RESULT Segmentation fault SOFTWARE/OS VERSIONS Linux/KDE Plasma: Kubuntu 24.04 KDE Frameworks Version: 6.14.0 Qt Version: 6.8.2 ADDITIONAL INFORMATION Thread 1 "kdevelop" received signal SIGSEGV, Segmentation fault. 0x00007bcefda2f9bf in ?? () from /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 (gdb) bt #0 0x00007bcefda2f9bf in ??? () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #1 0x00007bcefd7dd608 in ??? () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #2 0x00007bcefd9de93a in QAbstractItemModel::headerDataChanged(Qt::Orientation, int, int) () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #3 0x00007bcefda0e16a in QAbstractProxyModelPrivate::emitHeaderDataChanged() () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #4 0x00007bcefd7d1668 in QObject::event(QEvent*) () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #5 0x00007bcefed907a6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Widgets.so.6 #6 0x00007bcefd77bc32 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #7 0x00007bcefd77f1ad in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #8 0x00007bcefda584c7 in ??? () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #9 0x00007bcef8b145b5 in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #10 0x00007bcef8b73717 in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #11 0x00007bcef8b13a53 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #12 0x00007bcefda57b8e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #13 0x00007bcefd78830b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #14 0x00007bcefd7842f6 in QCoreApplication::exec() () at /home/user/Qt/6.8.2/gcc_64/lib/libQt6Core.so.6 #15 0x000055d28f002ffd in main (argc=<optimized out>, argv=<optimized out>) at /home/user/kde/src/kdevelop/app/main.cpp:835
added debug information files for qt. created another backtrace Thread 1 "kdevelop" received signal SIGSEGV, Segmentation fault. QSortFilterProxyModelPrivate::_q_sourceHeaderDataChanged (this=<optimized out>, orientation=Qt::Horizontal, start=<optimized out>, end=<optimized out>) at /home/qt/work/qt/qtbase/src/corelib/itemmodels/qsortfilterproxymodel.cpp:1554 warning: 1554 /home/qt/work/qt/qtbase/src/corelib/itemmodels/qsortfilterproxymodel.cpp: No such file or directory (gdb) bt #0 QSortFilterProxyModelPrivate::_q_sourceHeaderDataChanged (this=<optimized out>, orientation=Qt::Horizontal, start=<optimized out>, end=<optimized out>) at /home/qt/work/qt/qtbase/src/corelib/itemmodels/qsortfilterproxymodel.cpp:1554 #1 0x0000707be43dd608 in QtPrivate::QSlotObjectBase::call (a=0x7ffd4a70c3c0, r=0x59280d2d1a70, this=0x59280d217c90) at /home/qt/work/qt/qtbase/src/corelib/kernel/qobjectdefs_impl.h:486 #2 doActivate<false> (sender=0x59280d012000, signal_index=5, argv=argv@entry=0x7ffd4a70c3c0) at /home/qt/work/qt/qtbase/src/corelib/kernel/qobject.cpp:4115 #3 0x0000707be43d5a58 in QMetaObject::activate (sender=sender@entry=0x59280d012000, m=m@entry=0x707be48cc680 <QAbstractItemModel::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7ffd4a70c3c0) at /home/qt/work/qt/qtbase/src/corelib/kernel/qobject.cpp:4175 #4 0x0000707be45de93a in QAbstractItemModel::headerDataChanged (this=this@entry=0x59280d012000, _t1=<optimized out>, _t1@entry=Qt::Horizontal, _t2=<optimized out>, _t2@entry=0, _t3=<optimized out>) at /home/qt/work/qt/qtbase_build/src/corelib/Core_autogen/include/moc_qabstractitemmodel.cpp:1032 #5 0x0000707be460e16a in QAbstractProxyModelPrivate::emitHeaderDataChanged (this=0x59280e1a4250) at /home/qt/work/qt/qtbase/src/corelib/itemmodels/qabstractproxymodel.cpp:64 #6 0x0000707be43d1668 in QObject::event (this=0x59280d012000, e=0x59280f9f99f0) at /home/qt/work/qt/qtbase/src/corelib/kernel/qobject.cpp:1418 #7 0x0000707be59907a6 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x59280d012000, e=0x59280f9f99f0) at /home/qt/work/qt/qtbase/src/widgets/kernel/qapplication.cpp:3296 #8 0x0000707be437bc32 in QCoreApplication::notifyInternal2 (receiver=0x59280d012000, event=0x59280f9f99f0) at /home/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1172 #9 0x0000707be437be4d in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at /home/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1612 #10 0x0000707be437f1ad in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x59280a95e720) at /home/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1946 #11 0x0000707be437f460 in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>) at /home/qt/work/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1800 #12 0x0000707be46584c7 in postEventSourceDispatch (s=0x59280a9d7490) at /home/qt/work/qt/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:246 #13 0x0000707bdf7145b5 in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #14 0x0000707bdf773717 in ??? () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #15 0x0000707bdf713a53 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #16 0x0000707be4657b8e in QEventDispatcherGlib::processEvents (this=0x59280a9d3c60, flags=...) at /home/qt/work/qt/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:399 #17 0x0000707be438830b in QEventLoop::exec (this=this@entry=0x7ffd4a70c800, flags=..., flags@entry=...) at /home/qt/work/qt/qtbase/src/corelib/global/qflags.h:34 #18 0x0000707be43842f6 in QCoreApplication::exec () at /home/qt/work/qt/qtbase/src/corelib/global/qflags.h:74 #19 0x0000707be4dd5070 in QGuiApplication::exec () at /home/qt/work/qt/qtbase/src/gui/kernel/qguiapplication.cpp:1975 #20 0x0000707be5990719 in QApplication::exec () at /home/qt/work/qt/qtbase/src/widgets/kernel/qapplication.cpp:2564 #21 0x00005927d86c1ffd in main (argc=<optimized out>, argv=<optimized out>) at /home/user/kde/src/kdevelop/app/main.cpp:835
Similar to Bug 501267 in that the root cause is probably a bug in KNSWidgets::Button or in KDevelop's integration with it. Attempting to get more project templates or Qt Help documentation freezes the KDevelop UI (keyboard shortcuts such as Ctrl+Q still work thankfully). Getting more file templates crashes after the handler TemplateSelectionPagePrivate::handleNewStuffDialogFinished() is invoked. By the way, are the downloaded file templates saved correctly before the crash? The same warnings appear in the KDevelop ouptut in both the UI freeze and the segfault scenarios on my system: kf.kirigami.platform: Failed to find a Kirigami platform plugin for style "Fusion" file:///usr/lib/qt6/qml/org/kde/kirigami/templates/private/DrawerHandle.qml:117:5: TypeError: Cannot read property 'width' of null
(In reply to Igor Kushnir from comment #2) > By the way, are the downloaded file templates saved correctly before the crash? yes it does save the template
A simple workaround is the following patch for kdevelop/plugins/filetemplates/templateselectionpage.cpp: void TemplateSelectionPagePrivate::handleNewStuffDialogFinished() { model->refresh(); + ui->view->setCurrentIndex(QModelIndex{}); } But this patch is far from ideal because everything is deselected. A better solution would be to not refresh the model if nothing has changed and select the just installed template otherwise, as ProjectSelectionPage::handleNewStuffDialogFinished() does. And if nothing was installed, select the previously selected template with the first template as a fallback. Can anyone check/recall how this worked before the crash? Any ideas in which Qt or KF version the crash is present and absent?
(In reply to Igor Kushnir from comment #4) > Can anyone check/recall how this worked before the crash? Any ideas in which > Qt or KF version the crash is present and absent? Checked in Debian bookworm: KDevelop version 5.10.221202, KF version 5.103, Qt version 5.15.8. 1. When a template is downloaded from the Configure KDevelop=>Templates page, all tree items are collapsed just as it is now. I'll expand the tree to improve the behavior. 2. In the Create New Project dialog, one of the newly installed items is selected, or the first template if the detection of a newly installed item fails. I'll improve the detection and maybe, as a better fallback, select the same template as before the template tree refreshing. 3. In the Create Files from Template dialog, all template tree levels are deselected. I guess the invalid indices in KDevelop::MultiLevelListView cause the crash reported here since Qt 6. I'll make it work the same as in the Create New Project dialog.
Uninstalling a previously installed application template in the Get More Templates window also causes a segmentation fault with the same call stack as reported here. The reason is that ProjectSelectionPage::handleNewStuffDialogFinished() does not check whether an item that corresponds to a changed entry is selected successfully, and so when a template is uninstalled and cannot be selected, the very first index is also not selected as a fallback after the model is refreshed. This absence of any selection is what always occurs in TemplateSelectionPagePrivate::handleNewStuffDialogFinished() for file templates. And this causes a crash in recent KDevelop versions but not in older ones for some reason.
A possibly relevant merge request was started @ https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/784