Bug 364206

Summary: Crash when moving images outside Digikam
Product: [Applications] digikam Reporter: Kristian Karl <kristian.hermann.karl>
Component: Database-ScanAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles
Priority: NOR    
Version: 5.0.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 5.1.0
Sentry Crash Report:

Description Kristian Karl 2016-06-11 11:06:45 UTC
Using some file manager, moving images from one folder to another within an album crashes Digikam.

Reproducible: Always

Steps to Reproduce:
1. Start Digikam, and let the Albums view be displayed.
2. Start file manager Dolphin, and navigate to a folder within an album. 
3. From Dolphin, move the folder to som other place within the album

Actual Results:  
Digikam crashes, with following stack trace for crashing thread:
Thread 1 (Thread 0x7f39fe8b09c0 (LWP 10332)):
[KCrash Handler]
#6  0x00007f3a1e5b7120 in Digikam::Album::next (this=0xe1) at /home/krikar/dev/kde/digikam/core/libs/album/album.cpp:96
#7  0x00007f3a1e5812f0 in Digikam::AbstractAlbumModel::Private::findNthChild (this=0x3b10270, parent=0x57c1580, n=133) at /home/krikar/dev/kde/digikam/core/libs/models/abstractalbummodelpriv.h:70
#8  0x00007f3a1e57d97c in Digikam::AbstractAlbumModel::index (this=0x3b0fc40, row=133, column=0, parent=...) at /home/krikar/dev/kde/digikam/core/libs/models/abstractalbummodel.cpp:213
#9  0x00007f3a1e5a7763 in Digikam::AbstractCheckableAlbumTreeView::rowsInserted (this=0x3b03d80, parent=..., start=133, end=133) at /home/krikar/dev/kde/digikam/core/libs/album/albumtreeview.cpp:1394
#10 0x00007f3a1c58070a in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007f3a1ba1ba00 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007f3a1ba94044 in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007f3a1b99776b in QAbstractItemModel::endInsertRows() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007f3a1b9b8cbb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007f3a1b9bb724 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007f3a1b9bef39 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007f3a1ba1ba00 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007f3a1ba94044 in QAbstractItemModel::rowsInserted(QModelIndex const&, int, int, QAbstractItemModel::QPrivateSignal) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007f3a1b99776b in QAbstractItemModel::endInsertRows() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007f3a1e57e3cc in Digikam::AbstractAlbumModel::slotAlbumAdded (this=0x3b0fc40, album=0x591caf0) at /home/krikar/dev/kde/digikam/core/libs/models/abstractalbummodel.cpp:459
#21 0x00007f3a1e58bdfb in Digikam::AbstractAlbumModel::qt_static_metacall (_o=0x3b0fc40, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7ffeb4503660) at /home/krikar/dev/kde/digikam/build/core/libs/models/moc_abstractalbummodel.cpp:107
#22 0x00007f3a1ba1ba00 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#23 0x00007f3a1e5da72c in Digikam::AlbumManager::signalAlbumAdded (this=0x7f3a1ec5b4f0 <_ZZN7Digikam12_GLOBAL__N_113Q_QGS_creator13innerFunctionEvE6holder>, _t1=0x591caf0) at /home/krikar/dev/kde/digikam/build/core/libs/album/moc_albummanager.cpp:531
#24 0x00007f3a1e5c9771 in Digikam::AlbumManager::insertPAlbum (this=0x7f3a1ec5b4f0 <_ZZN7Digikam12_GLOBAL__N_113Q_QGS_creator13innerFunctionEvE6holder>, album=0x591caf0, parent=0x56c70b0) at /home/krikar/dev/kde/digikam/core/libs/album/albummanager.cpp:2911
#25 0x00007f3a1e5c29f6 in Digikam::AlbumManager::scanPAlbums (this=0x7f3a1ec5b4f0 <_ZZN7Digikam12_GLOBAL__N_113Q_QGS_creator13innerFunctionEvE6holder>) at /home/krikar/dev/kde/digikam/core/libs/album/albummanager.cpp:1409
#26 0x00007f3a1e5d9f23 in Digikam::AlbumManager::qt_static_metacall (_o=0x7f3a1ec5b4f0 <_ZZN7Digikam12_GLOBAL__N_113Q_QGS_creator13innerFunctionEvE6holder>, _c=QMetaObject::InvokeMetaMethod, _id=37, _a=0x7ffeb45039a0) at /home/krikar/dev/kde/digikam/build/core/libs/album/moc_albummanager.cpp:312
#27 0x00007f3a1ba1ba00 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x00007f3a1ba281f8 in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#29 0x00007f3a1ba1c7f3 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#30 0x00007f3a1c3221dc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#31 0x00007f3a1c327446 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#32 0x00007f3a1b9ef3d8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#33 0x00007f3a1ba4337e in QTimerInfoList::activateTimers() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#34 0x00007f3a1ba438b1 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#35 0x00007f3a1145d1a7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007f3a1145d400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007f3a1145d4ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007f3a1ba4448f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#39 0x00007f3a1b9ed15a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#40 0x00007f3a1b9f581c in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#41 0x0000000000406f22 in main (argc=1, argv=0x7ffeb4504738) at /home/krikar/dev/kde/digikam/core/app/main/main.cpp:252


Expected Results:  
Digikam should detect that the images has moved, and update the Albums view accordingly.

Digikam is compiled from sources, latest [core] commit is: 822d76621d4df4967e0dfd8556e5d67c932efc51

OS is latest from unstable from Neon:
Plasma: 5.6.90
KDE Frameworks: 5.23.0
Qt: 5.6.0
Comment 1 Kristian Karl 2016-06-11 19:28:22 UTC
It's not reproducible all the time. I have gotten the crash a couple of times on my production system. When I try to debug it on a small set of images and debug database, it will not crash so far...
I will try to debug it further,
Comment 2 caulier.gilles 2016-06-19 17:56:23 UTC
DK has of course a mechanism to follow changes in disk processed by another application.

Class is AlbumWatch based on QFileSystemWatcher API.

Gilles Caulier
Comment 3 caulier.gilles 2016-06-19 17:57:43 UTC
Here i tried to reproduce the problem, and i cannot.

How many items are stored in albums moved with Dolphin.

Gilles Caulier
Comment 4 Kristian Karl 2016-06-20 07:32:31 UTC
So, this weekend I tried to reproduce it using different folders with different files and number of sub folders etc. I used both small number of files, and with ~4.000 files. But I did not manage to get a crash. 
I think that this can be closed until I get a proper repro.
Comment 5 caulier.gilles 2016-06-20 07:36:07 UTC
Ok thanks for the feedback. Don't hesitate to re-open if you have fresh and suitable information to hack.

Gilles Caulier