Starting a rescan while another rescan is in progress can lead to duplicate entries being added to the database.
Upon database reload, KPhotoAlbum may detect the inconsistency and exit.
STEPS TO REPRODUCE
1. Create new image(s)
2. Start a disk rescan
3. Start a disk rescan again while previous one is still in progress
Duplicate images in the database. If database is saved, upon reloading KPhotoAlbum may detect the issue and exit:
~ ᐅ kphotoalbum
kphotoalbum.DB: Merging duplicate entry for file "jean-pierre/Post mortem/Inventaire/I10/I10,1/200105 b.tif"
Either queue the rescan, or inform the user that a rescan is ongoing and ask whether it should be cancelled and rescan started over.
Linux/KDE Plasma: Ubuntu 22.04.3 (only using KDE libs)
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
I'm scanning a NAS shared folder, so rescanning can take a few minutes and there's no visual clue that a rescan is still in progress. So it genuinely happened a few times.
I've seen reloading fix the duplicates once, maybe image checksums helped?
Starting a rescan while the rescan is still running in the background actually crashed on me, so I'm treating this as "bug confirmed". Thanks for reporting this!
Git commit 5667e29083004009cf60510c62ea690f1d234bc3 by Johannes Zarl-Zierl.
Committed on 12/10/2023 at 23:42.
Pushed by johanneszarl into branch 'master'.
Prevent scanning for new images in parallel
Add a mutex to prevent the user from starting a scan for new images
while another scan is still running.
This fixes a failed assertion if assertions are enabled, and potential
database corruption if assertions are not enabled.
M +1 -0 CHANGELOG.md
M +24 -3 DB/NewImageFinder.cpp
M +13 -4 DB/NewImageFinder.h