Bug 508344

Summary: Dolphin displays incorrect folder item count when refreshing during ongoing count operation
Product: [Applications] dolphin Reporter: Tomás Bolaño <tomas.bolano>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: dolphin-bugs-null
Priority: NOR    
Version First Reported In: 25.04.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tomás Bolaño 2025-08-16 14:58:48 UTC
SUMMARY
When dolphin is counting items in a large folder and we refresh before the count of a folder completes (e.g., by pressing F5), the interrupted folder shows an item count that is higher than the actual number of files present.

This appears to be a race condition where the interrupted count operation isn't properly cancelled, causing the results to accumulate incorrectly. The issue is reproducible with folders containing several thousands of items where the counting process is visibly slow enough to interrupt.

This may be considered a rare edge case since it requires both very large folders and the specific timing of refreshing the view during the counting process.

STEPS TO REPRODUCE
1. In the dolphin configuration (Settings → Configure Dolphin), in View → Content Display, the "Folder size" option should be set to "Show number of items"
2. The view mode can be any (Icons, Compact, or Details), but ensure that in View → Show Additional Information, "Size" is selected to display the folder sizes
3. Navigate to a directory containing a subdirectory with a very large number of files (10,000-100,000+ files). To create such a directory one can use this bash command:

   mkdir -p test_large_folder/large_subdir && cd test_large_folder/large_subdir && printf '%s\n' file_{1..50000}.txt | xargs touch

4. Refresh the view, for example pressing F5. It can be observed that the folder's item count increases as dolphin counts them.
5. Refresh the view again before the counting process completes for that folder.

OBSERVED RESULT
The folder that was interrupted during counting shows a higher number of items than actually exists in the folder.

EXPECTED RESULT
Refreshing during an ongoing count operation should cancel the previous count, resulting in the correct number of items being displayed once the new count completes.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 42
KDE Plasma Version: 6.4.3
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
Kernel Version: 6.15.9-201.fc42.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7840HS with Radeon 780M Graphics
Memory: 32 GiB of RAM (30.5 GiB usable)
Graphics Processor 1: AMD Radeon 780M Graphics
Graphics Processor 2: NVIDIA GeForce RTX 4060 Laptop GPU 

ADDITIONAL INFORMATION
Comment 1 Tomás Bolaño 2025-08-16 15:16:40 UTC
Nevermind, I saw that there was an update available in my system to dolphin 25.08.0, after updating I can no longer reproduce this issue, the bug appears to have been resolved in this version.