Bug 209207

Summary: Crash when deleting saved searches (GPS and Timeline)
Product: [Applications] digikam Reporter: Michael G. Hansen <mike>
Component: Searches-TimeLineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles, marcel.wiesweg
Priority: NOR    
Version: 1.0.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 1.0.0
Sentry Crash Report:

Description Michael G. Hansen 2009-10-02 13:44:43 UTC
Version:           1.0.0-beta5+r1030299 (using KDE 4.3.1)
OS:                Linux
Installed from:    Compiled From Sources

Save a few searches in GPS or Timeline, then delete one -> crash.
Versions: 1.0.0-beta4 (provided by debian), 1.0.0-beta5 up to current svn.

Backtrace from revision 1030299 (just before my merge of clustering support):

Application: digiKam (digikam), signal: Segmentation fault
[Current thread is 1 (Thread 0x7ff4a7b47750 (LWP 4374))]

Thread 16 (Thread 0x7ff495b91950 (LWP 4375)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261
#1  0x00007ff4a1432469 in QWaitConditionPrivate::wait (this=0x18848d8, mutex=0x18848d0, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:87
#2  QWaitCondition::wait (this=0x18848d8, mutex=0x18848d0, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:159
#3  0x00000000007601da in Digikam::ScanController::run (this=0x185c280) at /c/temp/kde/trunk-svn/digikam/digikam/scancontroller.cpp:499
#4  0x00007ff4a1431475 in QThreadPrivate::start (arg=0x185c280) at thread/qthread_unix.cpp:188
#5  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#6  0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#7  0x0000000000000000 in ?? ()

Thread 15 (Thread 0x7ff4923c8950 (LWP 4377)):
#0  0x00007fffafdff73c in clock_gettime ()
#1  0x00007ff49a398eef in *__GI_clock_gettime (clock_id=1, tp=0x7ff4923c7df0) at ../sysdeps/unix/clock_gettime.c:100
#2  0x00007ff4a15417dd in QTimerInfoList::getTime (this=<value optimized out>, t=...) at kernel/qeventdispatcher_unix.cpp:339
#3  0x00007ff4a15419c1 in QTimerInfoList::updateCurrentTime (this=0x1) at kernel/qeventdispatcher_unix.cpp:297
#4  0x00007ff4a15438c3 in QTimerInfoList::timerWait (this=0x1, tm=...) at kernel/qeventdispatcher_unix.cpp:420
#5  0x00007ff4a153fdcd in timerSourcePrepare (source=<value optimized out>, timeout=0x7ff4923c7ee4) at kernel/qeventdispatcher_glib.cpp:141
#6  0x00007ff49ac202e9 in g_main_context_prepare () from /lib/libglib-2.0.so.0
#7  0x00007ff49ac20679 in ?? () from /lib/libglib-2.0.so.0
#8  0x00007ff49ac20b3c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#9  0x00007ff4a153fc1e in QEventDispatcherGlib::processEvents (this=0x1a1fd20, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:329
#10 0x00007ff4a1515de2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#11 0x00007ff4a15161b4 in QEventLoop::exec (this=0x7ff4923c8070, flags=...) at kernel/qeventloop.cpp:201
#12 0x00007ff4a142e558 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:487
#13 0x00007ff4a4a041cb in Digikam::ImageFilterModelWorker::Thread::run (this=0x1a1f930) at /c/temp/kde/trunk-svn/digikam/libs/models/imagefiltermodelthreads.h:66
#14 0x00007ff4a1431475 in QThreadPrivate::start (arg=0x1a1f930) at thread/qthread_unix.cpp:188
#15 0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#16 0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#17 0x0000000000000000 in ?? ()

Thread 14 (Thread 0x7ff4911a0950 (LWP 4378)):
#0  0x00007fffafdff73c in clock_gettime ()
#1  0x00007ff49a398eef in *__GI_clock_gettime (clock_id=1, tp=0x7ff49119fdf0) at ../sysdeps/unix/clock_gettime.c:100
#2  0x00007ff4a15417dd in QTimerInfoList::getTime (this=<value optimized out>, t=...) at kernel/qeventdispatcher_unix.cpp:339
#3  0x00007ff4a15419c1 in QTimerInfoList::updateCurrentTime (this=0x1) at kernel/qeventdispatcher_unix.cpp:297
#4  0x00007ff4a15438c3 in QTimerInfoList::timerWait (this=0x1, tm=...) at kernel/qeventdispatcher_unix.cpp:420
#5  0x00007ff4a153fdcd in timerSourcePrepare (source=<value optimized out>, timeout=0x7ff49119fee4) at kernel/qeventdispatcher_glib.cpp:141
#6  0x00007ff49ac202e9 in g_main_context_prepare () from /lib/libglib-2.0.so.0
#7  0x00007ff49ac20679 in ?? () from /lib/libglib-2.0.so.0
#8  0x00007ff49ac20b3c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#9  0x00007ff4a153fc1e in QEventDispatcherGlib::processEvents (this=0x19ecf70, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:329
#10 0x00007ff4a1515de2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#11 0x00007ff4a15161b4 in QEventLoop::exec (this=0x7ff4911a0070, flags=...) at kernel/qeventloop.cpp:201
#12 0x00007ff4a142e558 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:487
#13 0x00007ff4a4a041cb in Digikam::ImageFilterModelWorker::Thread::run (this=0x1b23700) at /c/temp/kde/trunk-svn/digikam/libs/models/imagefiltermodelthreads.h:66
#14 0x00007ff4a1431475 in QThreadPrivate::start (arg=0x1b23700) at thread/qthread_unix.cpp:188
#15 0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#16 0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#17 0x0000000000000000 in ?? ()

Thread 13 (Thread 0x7ff49091f950 (LWP 4379)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261
#1  0x00007ff4a1432469 in QWaitConditionPrivate::wait (this=0x1d3cf10, mutex=0x1d3cf08, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:87
#2  QWaitCondition::wait (this=0x1d3cf10, mutex=0x1d3cf08, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:159
#3  0x00007ff4a4ea684b in Digikam::LoadSaveThread::run (this=0x1d3cef0) at /c/temp/kde/trunk-svn/digikam/libs/threadimageio/loadsavethread.cpp:136
#4  0x00007ff4a1431475 in QThreadPrivate::start (arg=0x1d3cef0) at thread/qthread_unix.cpp:188
#5  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#6  0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#7  0x0000000000000000 in ?? ()

Thread 12 (Thread 0x7ff49011e950 (LWP 4380)):
#0  0x00007fffafdff73c in clock_gettime ()
#1  0x00007ff49a398eef in *__GI_clock_gettime (clock_id=1, tp=0x7ff49011ddf0) at ../sysdeps/unix/clock_gettime.c:100
#2  0x00007ff4a15417dd in QTimerInfoList::getTime (this=<value optimized out>, t=...) at kernel/qeventdispatcher_unix.cpp:339
#3  0x00007ff4a15419c1 in QTimerInfoList::updateCurrentTime (this=0x1) at kernel/qeventdispatcher_unix.cpp:297
#4  0x00007ff4a15438c3 in QTimerInfoList::timerWait (this=0x1, tm=...) at kernel/qeventdispatcher_unix.cpp:420
#5  0x00007ff4a153fdcd in timerSourcePrepare (source=<value optimized out>, timeout=0x7ff49011dee4) at kernel/qeventdispatcher_glib.cpp:141
#6  0x00007ff49ac202e9 in g_main_context_prepare () from /lib/libglib-2.0.so.0
#7  0x00007ff49ac20679 in ?? () from /lib/libglib-2.0.so.0
#8  0x00007ff49ac20b3c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#9  0x00007ff4a153fc1e in QEventDispatcherGlib::processEvents (this=0x1d42420, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:329
#10 0x00007ff4a1515de2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#11 0x00007ff4a15161b4 in QEventLoop::exec (this=0x7ff49011e070, flags=...) at kernel/qeventloop.cpp:201
#12 0x00007ff4a142e558 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:487
#13 0x0000000000753e5b in Digikam::MetadataManagerWorker::Thread::run (this=0x1d413d0) at /c/temp/kde/deb-build-dev/digikam/digikam/../../../trunk-svn/digikam/digikam/metadatamanager_p.h:145
#14 0x00007ff4a1431475 in QThreadPrivate::start (arg=0x1d413d0) at thread/qthread_unix.cpp:188
#15 0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#16 0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#17 0x0000000000000000 in ?? ()

Thread 11 (Thread 0x7ff48f91d950 (LWP 4381)):
#0  0x00007fffafdff73c in clock_gettime ()
#1  0x00007ff49a398eef in *__GI_clock_gettime (clock_id=1, tp=0x7ff48f91cdf0) at ../sysdeps/unix/clock_gettime.c:100
#2  0x00007ff4a15417dd in QTimerInfoList::getTime (this=<value optimized out>, t=...) at kernel/qeventdispatcher_unix.cpp:339
#3  0x00007ff4a15419c1 in QTimerInfoList::updateCurrentTime (this=0x1) at kernel/qeventdispatcher_unix.cpp:297
#4  0x00007ff4a15438c3 in QTimerInfoList::timerWait (this=0x1, tm=...) at kernel/qeventdispatcher_unix.cpp:420
#5  0x00007ff4a153fdcd in timerSourcePrepare (source=<value optimized out>, timeout=0x7ff48f91cee4) at kernel/qeventdispatcher_glib.cpp:141
#6  0x00007ff49ac202e9 in g_main_context_prepare () from /lib/libglib-2.0.so.0
#7  0x00007ff49ac20679 in ?? () from /lib/libglib-2.0.so.0
#8  0x00007ff49ac20b3c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#9  0x00007ff4a153fc1e in QEventDispatcherGlib::processEvents (this=0x1d43e70, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:329
#10 0x00007ff4a1515de2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#11 0x00007ff4a15161b4 in QEventLoop::exec (this=0x7ff48f91d070, flags=...) at kernel/qeventloop.cpp:201
#12 0x00007ff4a142e558 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:487
#13 0x0000000000753e5b in Digikam::MetadataManagerWorker::Thread::run (this=0x1d439c0) at /c/temp/kde/deb-build-dev/digikam/digikam/../../../trunk-svn/digikam/digikam/metadatamanager_p.h:145
#14 0x00007ff4a1431475 in QThreadPrivate::start (arg=0x1d439c0) at thread/qthread_unix.cpp:188
#15 0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#16 0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#17 0x0000000000000000 in ?? ()

Thread 10 (Thread 0x7ff48f11c950 (LWP 4382)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261
#1  0x00007ff4a1432469 in QWaitConditionPrivate::wait (this=0x1d53830, mutex=0x1d53828, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:87
#2  QWaitCondition::wait (this=0x1d53830, mutex=0x1d53828, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:159
#3  0x00007ff4a4ea684b in Digikam::LoadSaveThread::run (this=0x1d53810) at /c/temp/kde/trunk-svn/digikam/libs/threadimageio/loadsavethread.cpp:136
#4  0x00007ff4a1431475 in QThreadPrivate::start (arg=0x1d53810) at thread/qthread_unix.cpp:188
#5  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#6  0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#7  0x0000000000000000 in ?? ()

Thread 9 (Thread 0x7ff4865db950 (LWP 4392)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:217
#1  0x00007ff48c170ca1 in ?? () from /usr/lib/libxine.so.1
#2  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#3  0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 8 (Thread 0x7ff483e4f950 (LWP 4396)):
#0  0x00007ff4a098cf02 in select () from /lib/libc.so.6
#1  0x00007ff48c199654 in xine_usec_sleep () from /usr/lib/libxine.so.1
#2  0x00007ff48c17e7bb in ?? () from /usr/lib/libxine.so.1
#3  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#4  0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 7 (Thread 0x7ff48364e950 (LWP 4397)):
#0  0x00007ff49f742ac0 in __pthread_mutex_unlock_usercnt (mutex=0x22d3628, decr=1) at pthread_mutex_unlock.c:64
#1  0x00007ff49ac20830 in ?? () from /lib/libglib-2.0.so.0
#2  0x00007ff49ac20b3c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#3  0x00007ff4a153fc1e in QEventDispatcherGlib::processEvents (this=0x22d3550, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:329
#4  0x00007ff4a1515de2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007ff4a15161b4 in QEventLoop::exec (this=0x7ff48364e040, flags=...) at kernel/qeventloop.cpp:201
#6  0x00007ff4a142e558 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:487
#7  0x00007ff48c3cb6ec in ?? () from /usr/lib/qt4/plugins/phonon_backend/phonon_xine.so
#8  0x00007ff4a1431475 in QThreadPrivate::start (arg=0x22d2f50) at thread/qthread_unix.cpp:188
#9  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#10 0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#11 0x0000000000000000 in ?? ()

Thread 6 (Thread 0x7ff482c44950 (LWP 4400)):
#0  0x00007ff4a0987372 in read () from /lib/libc.so.6
#1  0x00007ff48d0d3d25 in ?? () from /usr/lib/libasound.so.2
#2  0x00007ff48d0ce8c8 in snd_hctl_handle_events () from /usr/lib/libasound.so.2
#3  0x00007ff48d0d8225 in snd_mixer_handle_events () from /usr/lib/libasound.so.2
#4  0x00007ff482c49888 in ?? () from /usr/lib/xine/plugins/1.26/xineplug_ao_out_alsa.so
#5  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#6  0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#7  0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7ff482443950 (LWP 4401)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261
#1  0x00007ff48c181ce3 in ?? () from /usr/lib/libxine.so.1
#2  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#3  0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#4  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7ff47ecfd950 (LWP 4411)):
#0  __pthread_mutex_lock (mutex=0x3aa2268) at pthread_mutex_lock.c:86
#1  0x00007ff49ac20027 in g_main_context_check () from /lib/libglib-2.0.so.0
#2  0x00007ff49ac208a1 in ?? () from /lib/libglib-2.0.so.0
#3  0x00007ff49ac20b3c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#4  0x00007ff4a153fc1e in QEventDispatcherGlib::processEvents (this=0x3adfe50, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:329
#5  0x00007ff4a1515de2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007ff4a15161b4 in QEventLoop::exec (this=0x7ff47ecfd020, flags=...) at kernel/qeventloop.cpp:201
#7  0x00007ff4a142e558 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:487
#8  0x00007ff48122c61e in Marble::GpsdThread::run (this=0x3ad66c0) at ../../../../../../marble/src/plugins/positionprovider/gpsd/GpsdThread.cpp:27
#9  0x00007ff4a1431475 in QThreadPrivate::start (arg=0x3ad66c0) at thread/qthread_unix.cpp:188
#10 0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#11 0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#12 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7ff47fda5950 (LWP 4418)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:261
#1  0x00007ff4a1432469 in QWaitConditionPrivate::wait (this=0x4bbe650, mutex=0x4bbe648, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:87
#2  QWaitCondition::wait (this=0x4bbe650, mutex=0x4bbe648, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:159
#3  0x00007ff4a4ea684b in Digikam::LoadSaveThread::run (this=0x4bbe630) at /c/temp/kde/trunk-svn/digikam/libs/threadimageio/loadsavethread.cpp:136
#4  0x00007ff4a1431475 in QThreadPrivate::start (arg=0x4bbe630) at thread/qthread_unix.cpp:188
#5  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#6  0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#7  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7ff47f54d950 (LWP 4419)):
#0  0x00007ff4a098ad36 in *__GI___poll (fds=0x4eadda0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007ff49ac20859 in ?? () from /lib/libglib-2.0.so.0
#2  0x00007ff49ac20b3c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#3  0x00007ff4a153fc1e in QEventDispatcherGlib::processEvents (this=0x4f5fc90, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:329
#4  0x00007ff4a1515de2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007ff4a15161b4 in QEventLoop::exec (this=0x7ff47f54d020, flags=...) at kernel/qeventloop.cpp:201
#6  0x00007ff4a142e558 in QThread::exec (this=<value optimized out>) at thread/qthread.cpp:487
#7  0x00007ff48122c61e in Marble::GpsdThread::run (this=0x4ee8200) at ../../../../../../marble/src/plugins/positionprovider/gpsd/GpsdThread.cpp:27
#8  0x00007ff4a1431475 in QThreadPrivate::start (arg=0x4ee8200) at thread/qthread_unix.cpp:188
#9  0x00007ff49f73ff9a in start_thread (arg=<value optimized out>) at pthread_create.c:300
#10 0x00007ff4a099356d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#11 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ff4a7b47750 (LWP 4374)):
[KCrash Handler]
#5  0x000000000047a4a0 in QBasicAtomicInt::ref (this=0x25761800000001) at /usr/include/qt4/QtCore/qatomic_x86_64.h:121
#6  0x000000000047b388 in QString (this=0x7fffafca5790, other=...) at /usr/include/qt4/QtCore/qstring.h:712
#7  0x000000000065cbbe in Digikam::PAlbum::caption (this=0x6724280) at /c/temp/kde/trunk-svn/digikam/digikam/album.cpp:329
#8  0x00000000007150b4 in Digikam::ImageCategoryDrawer::textForPAlbum (this=0x1af1b00, album=0x6724280, recursive=true, count=21, header=0x7fffafca5920, subLine=0x7fffafca5910)
    at /c/temp/kde/trunk-svn/digikam/digikam/imagecategorydrawer.cpp:258
#9  0x00000000007158cb in Digikam::ImageCategoryDrawer::viewHeaderText (this=0x1af1b00, index=..., header=0x7fffafca5920, subLine=0x7fffafca5910)
    at /c/temp/kde/trunk-svn/digikam/digikam/imagecategorydrawer.cpp:201
#10 0x0000000000715b76 in Digikam::ImageCategoryDrawer::drawCategory (this=0x1af1b00, index=..., option=..., p=0x7fffafca5db0) at /c/temp/kde/trunk-svn/digikam/digikam/imagecategorydrawer.cpp:153
#11 0x0000000000737dc1 in KCategorizedView::Private::drawNewCategory (this=0x1b08f10, index=..., sortRole=0, option=..., painter=0x7fffafca5db0)
    at /c/temp/kde/trunk-svn/digikam/digikam/kcategorizedview.cpp:446
#12 0x000000000073ee74 in KCategorizedView::paintEvent (this=0x19ecc80, event=0x7fffafca6b30) at /c/temp/kde/trunk-svn/digikam/digikam/kcategorizedview.cpp:868
#13 0x000000000070db80 in Digikam::ImageCategorizedView::paintEvent (this=0x19ecc80, e=0x7fffafca6b30) at /c/temp/kde/trunk-svn/digikam/digikam/imagecategorizedview.cpp:951
#14 0x00007ff4a212c966 in QWidget::event (this=0x19ecc80, event=0x7fffafca6b30) at kernel/qwidget.cpp:7687
#15 0x00007ff4a2495cdb in QFrame::event (this=0x19ecc80, e=0x7fffafca6b30) at widgets/qframe.cpp:559
#16 0x00007ff4a25c877b in QAbstractItemView::viewportEvent (this=0x19ecc80, event=0x7fffafca6b30) at itemviews/qabstractitemview.cpp:1476
#17 0x00000000007102da in Digikam::ImageCategorizedView::viewportEvent (this=0x19ecc80, event=0x7fffafca6b30) at /c/temp/kde/trunk-svn/digikam/digikam/imagecategorizedview.cpp:992
#18 0x00007ff4a1516838 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=<value optimized out>, receiver=0x1b09fd0, event=0x7fffafca6b30) at kernel/qcoreapplication.cpp:726
#19 0x00007ff4a20dc7dc in QApplicationPrivate::notify_helper (this=0x1701310, receiver=0x1b09fd0, e=0x7fffafca6b30) at kernel/qapplication.cpp:4052
#20 0x00007ff4a20e486a in QApplication::notify (this=0x7fffafca7d40, receiver=0x1b09fd0, e=0x7fffafca6b30) at kernel/qapplication.cpp:4021
#21 0x00007ff4a34f743b in KApplication::notify (this=0x7fffafca7d40, receiver=0x1b09fd0, event=0x7fffafca6b30) at ../../kdeui/kernel/kapplication.cpp:302
#22 0x00007ff4a151751c in QCoreApplication::notifyInternal (this=0x7fffafca7d40, receiver=0x1b09fd0, event=0x7fffafca6b30) at kernel/qcoreapplication.cpp:610
#23 0x00007ff4a213398e in QWidgetPrivate::drawWidget (this=0x1b0dfa0, pdev=0x19d7c28, rgn=..., offset=..., flags=68, sharedPainter=0x0, backingStore=0x19d7b00) at kernel/qwidget.cpp:5079
#24 0x00007ff4a22aa33e in QWidgetBackingStore::sync (this=0x19d7b00) at painting/qbackingstore.cpp:1261
#25 0x00007ff4a21259f0 in QWidgetPrivate::syncBackingStore (this=0x199eea0) at kernel/qwidget.cpp:1603
#26 0x00007ff4a212c801 in QWidget::event (this=0x19c7780, event=0x677f780) at kernel/qwidget.cpp:7827
#27 0x00007ff4a24b01db in QMainWindow::event (this=0x19c7780, event=0x677f780) at widgets/qmainwindow.cpp:1399
#28 0x00007ff4a36018b3 in KXmlGuiWindow::event (this=0x25761800000001, ev=0x67242f0) at ../../kdeui/xmlgui/kxmlguiwindow.cpp:131
#29 0x00007ff4a20dc80d in QApplicationPrivate::notify_helper (this=0x1701310, receiver=0x19c7780, e=0x677f780) at kernel/qapplication.cpp:4056
#30 0x00007ff4a20e486a in QApplication::notify (this=0x7fffafca7d40, receiver=0x19c7780, e=0x677f780) at kernel/qapplication.cpp:4021
#31 0x00007ff4a34f743b in KApplication::notify (this=0x7fffafca7d40, receiver=0x19c7780, event=0x677f780) at ../../kdeui/kernel/kapplication.cpp:302
#32 0x00007ff4a151751c in QCoreApplication::notifyInternal (this=0x7fffafca7d40, receiver=0x19c7780, event=0x677f780) at kernel/qcoreapplication.cpp:610
#33 0x00007ff4a1518164 in QCoreApplication::sendEvent (receiver=0x0, event_type=0, data=0x16d0170) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#34 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x16d0170) at kernel/qcoreapplication.cpp:1247
#35 0x00007ff4a153ff73 in QCoreApplication::sendPostedEvents (s=<value optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218
#36 postEventSourceDispatch (s=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:210
#37 0x00007ff49ac1d12a in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#38 0x00007ff49ac20988 in ?? () from /lib/libglib-2.0.so.0
#39 0x00007ff49ac20b3c in g_main_context_iteration () from /lib/libglib-2.0.so.0
#40 0x00007ff4a153fbff in QEventDispatcherGlib::processEvents (this=0x16cfda0, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:327
#41 0x00007ff4a217364f in QGuiEventDispatcherGlib::processEvents (this=0x25761800000001, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:202
#42 0x00007ff4a1515de2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#43 0x00007ff4a15161b4 in QEventLoop::exec (this=0x7fffafca7ab0, flags=...) at kernel/qeventloop.cpp:201
#44 0x00007ff4a1518424 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#45 0x000000000080b047 in main (argc=1, argv=0x7fffafca82b8) at /c/temp/kde/trunk-svn/digikam/digikam/main.cpp:186
Comment 1 Andi Clemens 2009-10-02 13:54:18 UTC
Works fine here...
Comment 2 Andi Clemens 2009-10-03 13:54:31 UTC
The crash seems to appear in your Qt installation?
There is nothing wrong in the digiKam code, as far as I can see from the backtrace.
You are using an 64bit system, maybe this is the reason?
Comment 3 Michael G. Hansen 2009-10-03 14:15:01 UTC
You are right, the crash does not occur in a 32-bit chroot. Is there a known issue with Qt on 64 bit systems related to this?
Comment 4 Michael G. Hansen 2009-10-03 15:07:36 UTC
But it does crash when run under valgrind in 32-bit mode (using beta4) and there are a lot of invalid reads and writes preceding the crash, as soon as I delete the album.
Comment 5 Andi Clemens 2009-10-04 01:19:19 UTC
SVN commit 1031092 by aclemens:

When an album has been removed, set the search folder view to the current
search again, otherwise we get crashes.
A lot of album pointers in SearchFolderView still point to the currently
deleted album, and since the album has been removed, we get a SegFault.

For example:
Save a search, remove it again. The line edit for editing the simple search
keywords is still activated and you can enter a new keyword for the deleted
search. Hit enter: boom.
This is the backtrace Michael has posted here.

The crashes / invalid reads reported by valgrind are something I don't
understand. But you are right, it can crash any FolderSearchView (GPS,
TimeLine, Search, FuzzySearch) etc. But how to reproduce, I can't say. It
sometimes happens, sometimes not.

Another problem:
Create a search in GPS, call it 'aaa'.
Create another search in Search, also call it 'aaa', you get a dialog that says
that a search with this name already exists.
Sure, behind the scenes all those searches are of one type, but for the normal
user it is confusing when it reads "The search already exists" and he simply
can't see it in the FolderView.

Marcel,
any idea how to fix this?

In the meantime I will try to figure out how to crash GPSSearch with a defined
"pattern".

CCBUG:209207

 M  +2 -0      searchfolderview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1031092
Comment 6 Andi Clemens 2009-10-04 01:37:39 UTC
I'm not able to crash it, Michael if you experience it again, can you tell us exactly what you did?

Another problem:
Rename a GPSSearch: it works, but the folderview will be completely empty.
You have to restart digiKam to get it back.
Comment 7 Andi Clemens 2009-10-04 01:52:01 UTC
Michael, 

when using valgrind on a "debug" or "release" version of digiKam, I don't get the errors. Maybe valgrind is too confused with "debugfull" and it is best to run it on optimized code?
Comment 8 Michael G. Hansen 2009-10-04 11:30:07 UTC
(In reply to comment #5)
> SVN commit 1031092 by aclemens:
> Another problem:
> Create a search in GPS, call it 'aaa'.
> Create another search in Search, also call it 'aaa', you get a dialog that says
> that a search with this name already exists.
> Sure, behind the scenes all those searches are of one type, but for the normal
> user it is confusing when it reads "The search already exists" and he simply
> can't see it in the FolderView.

How about prepending the search names with "GPS:", "Timeline:" etc. internally. When displayed in the corresponding tabs, the "GPS:" and "Timeline:" prefixes can be stripped, but when shown in a "My Searches" dialog, they get shown.
Comment 9 Michael G. Hansen 2009-10-04 11:32:31 UTC
(In reply to comment #7)
> Michael, 
> 
> when using valgrind on a "debug" or "release" version of digiKam, I don't get
> the errors. Maybe valgrind is too confused with "debugfull" and it is best to
> run it on optimized code?

I ran it on the version in 1.0.0-beta4 version in debian 32 bit, with debug symbols installed. But that was in a chroot, so maybe it does not work correctly there.

I will try to crash the latest SVN again, but it currently does not compile.
Comment 10 Michael G. Hansen 2009-10-04 11:54:00 UTC
Okay, latest SVN (1031168): Could not crash it when run normally, only under Valgrind. Steps to reproduce: Timeline-> create searches a1, a2, a3, delete a2->crash.

Valgrind log of 64-bit version after clicking "Yes" in delete confirmation:

==7256== Invalid read of size 8                                                                                                                                                    
==7256==    at 0x6740AD: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:150)                                                                                
==7256==    by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821)                                                                             
==7256==    by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                                         
==7256==    by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                                             
==7256==    by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177)                                                                  
==7256==    by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273)                                            
==7256==    by 0x5F39DD: Digikam::TimeLineFolderView::qt_metacall(QMetaObject::Call, int, void**) (timelinefolderview.moc:93)                                                      
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x6C73CA4: Q3ListView::contextMenuRequested(Q3ListViewItem*, QPoint const&, int) (moc_q3listview.cpp:372)                                                           
==7256==    by 0x6B22DE4: Q3ListView::contentsContextMenuEvent(QContextMenuEvent*) (q3listview.cpp:4370)                                                                           
==7256==  Address 0x31ad9ed0 is 0 bytes inside a block of size 16 free'd                                                                                                           
==7256==    at 0x4C21ACE: operator delete(void*) (vg_replace_malloc.c:346)                                                                                                         
==7256==    by 0x6740D1: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:152)                                                                                
==7256==    by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821)                                                                             
==7256==    by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                                         
==7256==    by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                                             
==7256==    by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177)                                                                  
==7256==    by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273)                                            
==7256==    by 0x5F39DD: Digikam::TimeLineFolderView::qt_metacall(QMetaObject::Call, int, void**) (timelinefolderview.moc:93)                                                      
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x6C73CA4: Q3ListView::contextMenuRequested(Q3ListViewItem*, QPoint const&, int) (moc_q3listview.cpp:372)                                                           
==7256==                                                                                                                                                                           
==7256== Invalid free() / delete / delete[]                                                                                                                                        
==7256==    at 0x4C21ACE: operator delete(void*) (vg_replace_malloc.c:346)                                                                                                         
==7256==    by 0x6740D1: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:152)                                                                                
==7256==    by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821)                                                                             
==7256==    by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                                         
==7256==    by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                                             
==7256==    by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177)                                                                  
==7256==    by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273)                                            
==7256==    by 0x5F39DD: Digikam::TimeLineFolderView::qt_metacall(QMetaObject::Call, int, void**) (timelinefolderview.moc:93)                                                      
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x6C73CA4: Q3ListView::contextMenuRequested(Q3ListViewItem*, QPoint const&, int) (moc_q3listview.cpp:372)                                                           
==7256==  Address 0x31ad9ed0 is 0 bytes inside a block of size 16 free'd                                                                                                           
==7256==    at 0x4C21ACE: operator delete(void*) (vg_replace_malloc.c:346)                                                                                                         
==7256==    by 0x6740D1: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:152)                                                                                
==7256==    by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821)                                                                             
==7256==    by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                                         
==7256==    by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                                             
==7256==    by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177)                                                                  
==7256==    by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273)                                            
==7256==    by 0x5F39DD: Digikam::TimeLineFolderView::qt_metacall(QMetaObject::Call, int, void**) (timelinefolderview.moc:93)                                                      
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x6C73CA4: Q3ListView::contextMenuRequested(Q3ListViewItem*, QPoint const&, int) (moc_q3listview.cpp:372)                                                           
==7256==                                                                                                                                                                           
==7256== Invalid read of size 1                                                                                                                                                    
==7256==    at 0x4C2410E: memmove (mc_replace_strmem.c:613)                                                                                                                        
==7256==    by 0xB1465F8: QListData::remove(int) (qlistdata.cpp:218)                                                                                                               
==7256==    by 0xB14663A: QListData::erase(void**) (qlistdata.cpp:283)                                                                                                             
==7256==    by 0x675241: QList<Digikam::HistoryItem*>::erase(QList<Digikam::HistoryItem*>::iterator) (qlist.h:392)                                                                 
==7256==    by 0x674102: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:153)                                                                                
==7256==    by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821)                                                                             
==7256==    by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                                         
==7256==    by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                                             
==7256==    by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177)                                                                  
==7256==    by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273)                                            
==7256==  Address 0x39bafa90 is 0 bytes after a block of size 128 alloc'd                                                                                                          
==7256==    at 0x4C222A8: realloc (vg_replace_malloc.c:476)                                                                                                                        
==7256==    by 0xB1466BA: QListData::realloc(int) (qlistdata.cpp:111)                                                                                                              
==7256==    by 0xB1468DA: QListData::append() (qlistdata.cpp:131)                                                                                                                  
==7256==    by 0x6751D2: QList<Digikam::HistoryItem*>::append(Digikam::HistoryItem* const&) (qlist.h:429)                                                                          
==7256==    by 0x675202: QList<Digikam::HistoryItem*>::push_back(Digikam::HistoryItem* const&) (qlist.h:266)                                                                       
==7256==    by 0x674702: Digikam::AlbumHistory::addAlbum(Digikam::Album*, QWidget*) (albumhistory.cpp:126)                                                                         
==7256==    by 0x6F843F: Digikam::DigikamView::slotAlbumSelected(Digikam::Album*) (digikamview.cpp:1175)                                                                           
==7256==    by 0x6F8B36: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:287)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x683D3C: Digikam::AlbumManager::signalAlbumCurrentChanged(Digikam::Album*) (albummanager.moc:242)                                                                  
==7256==    by 0x683D6F: Digikam::AlbumManager::setCurrentAlbum(Digikam::Album*) (albummanager.cpp:1632)                                                                           
==7256==    by 0x5F504C: Digikam::TimeLineView::createNewDateSearchAlbum(QString const&) (timelineview.cpp:462)                                                                    
==7256==                                                                                                                                                                           
==7256== Invalid read of size 1                                                                                                                                                    
==7256==    at 0x4C24100: memmove (mc_replace_strmem.c:613)                                                                                                                        
==7256==    by 0xB1465F8: QListData::remove(int) (qlistdata.cpp:218)                                                                                                               
==7256==    by 0xB14663A: QListData::erase(void**) (qlistdata.cpp:283)                                                                                                             
==7256==    by 0x675241: QList<Digikam::HistoryItem*>::erase(QList<Digikam::HistoryItem*>::iterator) (qlist.h:392)                                                                 
==7256==    by 0x674102: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:153)                                                                                
==7256==    by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821)                                                                             
==7256==    by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                                         
==7256==    by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                                             
==7256==    by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177)                                                                  
==7256==    by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273)                                            
==7256==  Address 0x39bafa91 is 1 bytes after a block of size 128 alloc'd                                                                                                          
==7256==    at 0x4C222A8: realloc (vg_replace_malloc.c:476)                                                                                                                        
==7256==    by 0xB1466BA: QListData::realloc(int) (qlistdata.cpp:111)                                                                                                              
==7256==    by 0xB1468DA: QListData::append() (qlistdata.cpp:131)                                                                                                                  
==7256==    by 0x6751D2: QList<Digikam::HistoryItem*>::append(Digikam::HistoryItem* const&) (qlist.h:429)                                                                          
==7256==    by 0x675202: QList<Digikam::HistoryItem*>::push_back(Digikam::HistoryItem* const&) (qlist.h:266)                                                                       
==7256==    by 0x674702: Digikam::AlbumHistory::addAlbum(Digikam::Album*, QWidget*) (albumhistory.cpp:126)                                                                         
==7256==    by 0x6F843F: Digikam::DigikamView::slotAlbumSelected(Digikam::Album*) (digikamview.cpp:1175)                                                                           
==7256==    by 0x6F8B36: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:287)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x683D3C: Digikam::AlbumManager::signalAlbumCurrentChanged(Digikam::Album*) (albummanager.moc:242)                                                                  
==7256==    by 0x683D6F: Digikam::AlbumManager::setCurrentAlbum(Digikam::Album*) (albummanager.cpp:1632)                                                                           
==7256==    by 0x5F504C: Digikam::TimeLineView::createNewDateSearchAlbum(QString const&) (timelineview.cpp:462)                                                                    
==7256==                                                                                                                                                                           
==7256== Invalid write of size 1                                                                                                                                                   
==7256==    at 0x4C24104: memmove (mc_replace_strmem.c:613)                                                                                                                        
==7256==    by 0xB1465F8: QListData::remove(int) (qlistdata.cpp:218)                                                                                                               
==7256==    by 0xB14663A: QListData::erase(void**) (qlistdata.cpp:283)                                                                                                             
==7256==    by 0x675241: QList<Digikam::HistoryItem*>::erase(QList<Digikam::HistoryItem*>::iterator) (qlist.h:392)                                                                 
==7256==    by 0x674102: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:153)                                                                                
==7256==    by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821)                                                                             
==7256==    by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                                         
==7256==    by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                                             
==7256==    by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177)                                                                  
==7256==    by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273)                                            
==7256==  Address 0x39bafa90 is 0 bytes after a block of size 128 alloc'd                                                                                                          
==7256==    at 0x4C222A8: realloc (vg_replace_malloc.c:476)                                                                                                                        
==7256==    by 0xB1466BA: QListData::realloc(int) (qlistdata.cpp:111)                                                                                                              
==7256==    by 0xB1468DA: QListData::append() (qlistdata.cpp:131)                                                                                                                  
==7256==    by 0x6751D2: QList<Digikam::HistoryItem*>::append(Digikam::HistoryItem* const&) (qlist.h:429)                                                                          
==7256==    by 0x675202: QList<Digikam::HistoryItem*>::push_back(Digikam::HistoryItem* const&) (qlist.h:266)                                                                       
==7256==    by 0x674702: Digikam::AlbumHistory::addAlbum(Digikam::Album*, QWidget*) (albumhistory.cpp:126)                                                                         
==7256==    by 0x6F843F: Digikam::DigikamView::slotAlbumSelected(Digikam::Album*) (digikamview.cpp:1175)                                                                           
==7256==    by 0x6F8B36: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:287)                                                                   
==7256==    by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112)                                                                                     
==7256==    by 0x683D3C: Digikam::AlbumManager::signalAlbumCurrentChanged(Digikam::Album*) (albummanager.moc:242)                                                                  
==7256==    by 0x683D6F: Digikam::AlbumManager::setCurrentAlbum(Digikam::Album*) (albummanager.cpp:1632)                                                                           
==7256==    by 0x5F504C: Digikam::TimeLineView::createNewDateSearchAlbum(QString const&) (timelineview.cpp:462)                                                                    
==7256==                                                                                                                                                                           
==7256==                                                                                                                                                                           
==7256== More than 10000000 total errors detected.  I'm not reporting any more.                                                                                                    
==7256== Final error counts will be inaccurate.  Go fix your program!                                                                                                              
==7256== Rerun with --error-limit=no to disable this cutoff.  Note                                                                                                                 
==7256== that errors may occur in your program without prior warning from                                                                                                          
==7256== Valgrind, because errors are no longer being displayed.                                                                                                                   
==7256==                                                                                                                                                                           
KCrash: Application 'digikam' crashing...                                                                                                                                          
Unable to start Dr. Konqi                                                                                                                                                          
--7256-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting                                                                                                
--7256-- si_code=1;  Faulting address: 0x7;  sp: 0x41336e080                                                                                                                       

valgrind: the 'impossible' happened:
   Killed by fatal signal           
==7256==    at 0x38035895: unlinkBlock (m_mallocfree.c:368)
==7256==    by 0x38037780: vgPlain_arena_free (m_mallocfree.c:1517)
==7256==    by 0x38001E91: die_and_free_mem (mc_malloc_wrappers.c:123)
==7256==    by 0x38064768: vgPlain_scheduler (scheduler.c:1362)       
==7256==    by 0x38033E8D: final_tidyup (m_main.c:2581)               
==7256==    by 0x380341B3: shutdown_actions_NORETURN (m_main.c:2370)  
==7256==    by 0x3808D1C9: run_a_thread_NORETURN (syswrap-linux.c:146)
==7256==    by 0x3808D22A: vgModuleLocal_start_thread_NORETURN (syswrap-linux.c:214)
==7256==    by 0x3808F4BD: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==7256==    by 0xDEADBEEFDEADBEEE: ???
==7256==    by 0xDEADBEEFDEADBEEE: ???
==7256==    by 0xDEADBEEFDEADBEEE: ???

sched status:
  running_tid=4

Thread 4: status = VgTs_Runnable
==7256==    at 0x4C21DBC: free (vg_replace_malloc.c:325)
==7256==    by 0xBDAE5B8: ??? (in /lib/libc-2.9.so)
==7256==    by 0xBDAE278: ??? (in /lib/libc-2.9.so)
==7256==    by 0xBDAE981: ??? (in /lib/libc-2.9.so)
==7256==    by 0x4A1E590: _vgnU_freeres (vg_preloaded.c:62)
Comment 11 Andi Clemens 2009-10-04 11:59:39 UTC
Yes, under valgrind it crashes, but I guess this is due to the fact that valgrind is too intrusive here.
At least I use it with CGDB attached, this will crash it. When I do a normal memcheck, nothing crashes.
Comment 12 Andi Clemens 2009-10-04 12:02:08 UTC
I really don't understand these results, I checked all the variables and objects involved in it, but there is no null pointer or some other issue I can think of. But it always says:
Invalid read of 4 at
==7256==  Address 0x39bafa90 is 0 bytes after a block of size 128 alloc'd  

so something has been deleted at this address, right?
Comment 13 Marcel Wiesweg 2009-10-04 15:53:34 UTC
> When an album has been removed, set the search folder view to the current
> search again, otherwise we get crashes.
> A lot of album pointers in SearchFolderView still point to the currently
> deleted album, and since the album has been removed, we get a SegFault.
> 

There is also the option of using an AlbumPointer<> in these cases. See albummanager.h at the bottom.

> Another problem:
> Create a search in GPS, call it 'aaa'.
> Create another search in Search, also call it 'aaa', you get a dialog that says
> that a search with this name already exists.
> Sure, behind the scenes all those searches are of one type, but for the normal
> 
> Marcel,
> any idea how to fix this?

Historically, we only had one type of searches, and this was all right. Now we have plenty of types, and indeed there is no need for unique names. We can be unique on type+name. This needs a change to all checkName() methods copy-and-pasted in the sidebars, and a change to createSAlbum in the AlbumManager.

(In reply to comment #12)
> I really don't understand these results, I checked all the variables and
> objects involved in it, but there is no null pointer or some other issue I can
> think of. But it always says:
> Invalid read of 4 at
> ==7256==  Address 0x39bafa90 is 0 bytes after a block of size 128 alloc'd  
> 
> so something has been deleted at this address, right?

Yes, seems to be.

From Michael's log, as usual, the first problem should be fixed, which is in short:
Invalid read of size 8:                                       
Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:150)                                                          
Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821)   
Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)         

AlbumHistory looks like complex code that could be written much more readably with standard Qt containers...
Comment 14 Andi Clemens 2009-10-04 16:00:23 UTC
The question is: what is the problem? :)
I attached valgrind to GDB and fiddled around, but there seems to be no error.
When running without valgrind or gdb, everything seems to be fine though.
Comment 15 Michael G. Hansen 2009-10-05 09:02:03 UTC
(In reply to comment #6)
> Another problem:
> Rename a GPSSearch: it works, but the folderview will be completely empty.
> You have to restart digiKam to get it back.

Sorry I missed this message. I will try look into it this afternoon.

Michael
Comment 16 caulier.gilles 2009-10-05 09:52:30 UTC
Do you want that i delay a little bit beta5 release ?

I'm waiting a fix for this issue this week end, before to make tarball...

Gilles
Comment 17 Michael G. Hansen 2009-10-05 12:25:34 UTC
(In reply to comment #16)
> Do you want that i delay a little bit beta5 release ?
> 
> I'm waiting a fix for this issue this week end, before to make tarball...
> 
> Gilles

I can't find the problem with the renamed albums right now, so go ahead ...

Michael
Comment 18 Andi Clemens 2009-10-09 17:29:32 UTC
This problem is weird. As you can see in this trace, the item gets deleted twice:

 Invalid read of size 4                                                                                                                                 
==21813==    at 0x822DCCC: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:146)                                                            
==21813==    by 0x82912A7: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:822)                                                         
==21813==    by 0x828B878: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                               
==21813==    by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                                    
==21813==    by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                     
==21813==    by 0x8233C7F: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                     
==21813==    by 0x82424E9: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                         
==21813==    by 0x81C2A80: Digikam::GPSSearchFolderView::searchDelete(Digikam::SAlbum*) (gpssearchfolderview.cpp:184)                                            
==21813==    by 0x81C368E: Digikam::GPSSearchFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (gpssearchfolderview.cpp:309)                      
==21813==    by 0x81C1D49: Digikam::GPSSearchFolderView::qt_metacall(QMetaObject::Call, int, void**) (gpssearchfolderview.moc:95)                                
==21813==    by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                                    
==21813==    by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                     
==21813==  Address 0x19b733d8 is 0 bytes inside a block of size 8 free'd                                                                                         
==21813==    at 0x402322D: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)                                                         
==21813==    by 0x822DCEC: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:148)                                                            
==21813==    by 0x82912A7: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:822)                                                         
==21813==    by 0x828B878: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                               
==21813==    by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                                    
==21813==    by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                     
==21813==    by 0x8233C7F: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                     
==21813==    by 0x82424E9: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                         
==21813==    by 0x81C2A80: Digikam::GPSSearchFolderView::searchDelete(Digikam::SAlbum*) (gpssearchfolderview.cpp:184)                                            
==21813==    by 0x81C368E: Digikam::GPSSearchFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (gpssearchfolderview.cpp:309)                      
==21813==    by 0x81C1D49: Digikam::GPSSearchFolderView::qt_metacall(QMetaObject::Call, int, void**) (gpssearchfolderview.moc:95)                                
==21813==    by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                                    
==21813==                                                                                                                                                        
==21813== Invalid free() / delete / delete[]                                                                                                                     
==21813==    at 0x402322D: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)                                                         
==21813==    by 0x822DCEC: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:148)                                                            
==21813==    by 0x82912A7: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:822)                                                         
==21813==    by 0x828B878: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                               
==21813==    by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                                    
==21813==    by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                     
==21813==    by 0x8233C7F: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                     
==21813==    by 0x82424E9: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                         
==21813==    by 0x81C2A80: Digikam::GPSSearchFolderView::searchDelete(Digikam::SAlbum*) (gpssearchfolderview.cpp:184)                                            
==21813==    by 0x81C368E: Digikam::GPSSearchFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (gpssearchfolderview.cpp:309)                      
==21813==    by 0x81C1D49: Digikam::GPSSearchFolderView::qt_metacall(QMetaObject::Call, int, void**) (gpssearchfolderview.moc:95)                                
==21813==    by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                                    
==21813==  Address 0x19b733d8 is 0 bytes inside a block of size 8 free'd                                                                                         
==21813==    at 0x402322D: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)                                                         
==21813==    by 0x822DCEC: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:148)                                                            
==21813==    by 0x82912A7: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:822)                                                         
==21813==    by 0x828B878: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283)                                               
==21813==    by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                                    
==21813==    by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3)                                     
==21813==    by 0x8233C7F: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222)                                                     
==21813==    by 0x82424E9: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356)                                                         
==21813==    by 0x81C2A80: Digikam::GPSSearchFolderView::searchDelete(Digikam::SAlbum*) (gpssearchfolderview.cpp:184)                                            
==21813==    by 0x81C368E: Digikam::GPSSearchFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (gpssearchfolderview.cpp:309)                      
==21813==    by 0x81C1D49: Digikam::GPSSearchFolderView::qt_metacall(QMetaObject::Call, int, void**) (gpssearchfolderview.moc:95)                                
==21813==    by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3)     


When I remove the line albumhistory.cpp:148 (delete *iter), digiKam always crashes (or ends up in an infinite loop).
If you use kDebug() to analyze the pointers, you can see that
QList::erase() is NOT returning the next iter object pointer, but the current one.
Why?

I first thought this is an Qt 4.5.3 issue, but I wrote a small test app and in there it didn't happen.

Valgrind will also state somewhere that AlbumHistory::addAlbum() is re-allocating memory when using QList::push_back() or QList::append().

I then thought that we might have a race condition and that AlbumHistory::addAlbum() is called while deleteAlbum is running and therefore make the iterator invalid.

But this is not the case.

So what is this? Why is erase() not working correctly here?
I also made the stack lists normal objects instead of pointers, but it is not working.

Any idea?
This is a serious problem that will mostly all the time crash digiKam.
There must be some simple explanation, but I can't find it at the moment.

Andi
Comment 19 Marcel Wiesweg 2009-10-09 18:17:44 UTC
> If you use kDebug() to analyze the pointers, you can see that
> QList::erase() is NOT returning the next iter object pointer, but the current
> one.
> Why?

I will assume, until proven otherwise, that QList is working perfectly and our code is faulty ;-)

Is it returning the same iterator, or the same AlbumHistory pointer? In the latter case, probably, this pointer is added twice?

What about the idea of rewriting the class value-based around a QList<HistoryItem> or a QStack<HistoryItem>?
Comment 20 Andi Clemens 2009-10-09 18:26:52 UTC
It is returning the same HistoryItem pointer.
It is not added twice, I checked that.
QList::erase() works perfectly fine in other code. It could be that addAlbum() is somehow called, but when I set a breakpoint in there, it is not executed when I delete a HistoryItem.

This bug is killing me, I spent 5 hours in total now on it :D
Weird thing, and without valgrind you will get no useful info at all, gdb is not detecting that the item has been already removed (invalid read of 4).
Comment 21 Andi Clemens 2009-10-10 11:58:15 UTC
I have extracted our code from AlbumHistory into a separate small app:
http://digikam3rdparty.free.fr/misc.tarballs/temp/crashy.tar.gz

If you compile it, you get the crash (and if you run valgrind you get the same errors as in digiKam).

Now uncomment the "delete *iter" line, it will work.
Question is: Are we doing something stupid here or is it a bug in Qt?
When we DON'T delete the object that iter points to, it crashes (QList::erase() returns the same iterator object), but if we DO delete it, everything is fine?
Weird!

Andi
Comment 22 Andi Clemens 2009-10-12 19:46:42 UTC
SVN commit 1034433 by aclemens:

Fix crash due to invalid iterator usage.
I guess such fixes need to be done throughout the digiKam code base.

BUG:209207

 M  +5 -9      albumhistory.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1034433