Bug 500241

Summary: Crash when opening duplicated file entry in projects tool
Product: [Applications] kate Reporter: Björn Bengtsson <bjorn>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: christian_gruber
Priority: NOR Keywords: drkonqi
Version First Reported In: 24.12.2   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report: https://crash-reports.kde.org/organizations/kde/issues/134550/events/97778aa95920414f80225400f479d244/
Attachments: New crash information added by DrKonqi
Another crash report

Description Björn Bengtsson 2025-02-17 10:07:12 UTC
Application: kate (24.12.2)

ApplicationNotResponding [ANR]: false
Qt Version: 6.8.2
Frameworks Version: 6.10.0
Operating System: Linux 6.12.11-200.fc41.x86_64 x86_64
Windowing System: Wayland
Distribution: "Fedora Linux 41 (Forty One)"
DrKonqi: 6.3.0 [CoredumpBackend]

-- Information about the crash:
I'm running a pretty standard installation of Fedora 41 with KDE Plasma.
I have a saved session open in Kate and the projects tool is showing a local folder.
This is how the crash is reproduced:

1) In the projects tool, select a file system folder.
2) Right-click the folder and select "New file".
3) Enter a file name. The new file is created on the file system and displayed in the list nested under the folder I right-clicked.
4) Right-click the same folder again and select "New file".
5) Enter the SAME file name as in step 3. When clicking OK, a second ENTRY is created and displayed in the list (but no file is created on the file system).
6) Select one of the "new" files and right-click it (it doesn't matter which one).
7) Select "Delete". The file is deleted from the file system and the entry is removed from the list.
8) Double-click the remaining duplicated "new" file entry. This will crash Kate.

Kate: v24.12.2
KDE Plasma: v6.3.0
KDE Frameworks: v6.10.0
Qt: v6.8.2
Kernel: v6.12.11-200

The crash can be reproduced every time.

-- Backtrace (Reduced):
#5  0x00007f37f5fc1b74 in QHashPrivate::iterator<QHashPrivate::Node<QtPrivate::QModelIndexWrapper, QSortFilterProxyModelPrivate::Mapping*> >::node (this=<synthetic pointer>) at /usr/src/debug/qt6-qtbase-6.8.2-2.fc41.x86_64/src/corelib/tools/qhash.h:795
#6  QHash<QtPrivate::QModelIndexWrapper, QSortFilterProxyModelPrivate::Mapping*>::const_iterator::key (this=<synthetic pointer>) at /usr/src/debug/qt6-qtbase-6.8.2-2.fc41.x86_64/src/corelib/tools/qhash.h:1186
#7  QSortFilterProxyModel::parent (this=0x556692c5dd50, child=<optimized out>) at /usr/src/debug/qt6-qtbase-6.8.2-2.fc41.x86_64/src/corelib/itemmodels/qsortfilterproxymodel.cpp:2141
#8  0x00007f37f5f8f3ed in QModelIndex::parent (this=0x7fffb6efb310) at /usr/src/debug/qt6-qtbase-6.8.2-2.fc41.x86_64/src/corelib/itemmodels/qabstractitemmodel.h:506
#9  QItemSelection::select (this=this@entry=0x7fffb6efb280, topLeft=..., bottomRight=...) at /usr/src/debug/qt6-qtbase-6.8.2-2.fc41.x86_64/src/corelib/itemmodels/qitemselectionmodel.cpp:393


Reported using DrKonqi
Comment 1 Björn Bengtsson 2025-02-17 10:07:14 UTC
Created attachment 178472 [details]
New crash information added by DrKonqi

DrKonqi auto-attaching complete backtrace.
Comment 2 Björn Bengtsson 2025-02-17 10:08:56 UTC
Created attachment 178473 [details]
Another crash report
Comment 3 Waqar Ahmed 2025-02-17 10:42:44 UTC
Git commit 17dd0e382e44a39164b5ec2359e02f36c9f8363a by Waqar Ahmed.
Committed on 17/02/2025 at 10:42.
Pushed by waqar into branch 'master'.

Avoid creating duplicate files

M  +8    -0    addons/project/kateprojectviewtree.cpp

https://invent.kde.org/utilities/kate/-/commit/17dd0e382e44a39164b5ec2359e02f36c9f8363a
Comment 4 Waqar Ahmed 2025-03-13 09:16:30 UTC
*** Bug 501288 has been marked as a duplicate of this bug. ***