Bug 176472 - Moving/Deleting all files from an album crashes digikam
Summary: Moving/Deleting all files from an album crashes digikam
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Thumbs-BarView (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-29 18:21 UTC by Yann LE HIR
Modified: 2022-01-21 14:47 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 7.6.0


Attachments
gdb trace (1.65 KB, application/octet-stream)
2008-11-29 18:22 UTC, Yann LE HIR
Details
patch (1.21 KB, patch)
2008-11-29 18:24 UTC, Yann LE HIR
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yann LE HIR 2008-11-29 18:21:43 UTC
Version:           0.10.0-SVN-890620 (using KDE 4.1.3)
Compiler:          cmake 2.6, gcc 4.1.2 
OS:                Linux
Installed from:    Gentoo Packages

When moving all photos from an album to an other crashes digikam.

gdb trace & patch coming.
Comment 1 Yann LE HIR 2008-11-29 18:22:22 UTC
Created attachment 28928 [details]
gdb trace
Comment 2 Yann LE HIR 2008-11-29 18:24:40 UTC
Created attachment 28929 [details]
patch

Patch to apply in digikam/utilities/imageeditor/editor
Solved the problem.
Comment 3 FiNeX 2008-11-30 13:49:57 UTC
Backtrace from comment #1:


digikam(21661) Digikam::ImageScanner::addImage: Adding new item "144.JPG"
digikam(21661) Digikam::ImageScanner::copyFromSource: Recognized "XXX/144.JPG" as copied from 61584
ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/qt4/QtCore/qlist.h, line 401

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb4c29700 (LWP 21661)]
0xffffe424 in __kernel_vsyscall ()
(gdb)
(gdb) bt
#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb51edf4f in raise () from /lib/libc.so.6
#2  0xb530eff4 in ?? () from /lib/libc.so.6
#3  0xb4c29700 in ?? ()
#4  0xb51ef958 in abort () from /lib/libc.so.6
#5  0x00000040 in ?? ()
#6  0x0808f38a in Digikam::ImageWindow::removeItem (this=0xaa31cac8, index=1)
    at /home/build/digikam_4.1/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp:1135
#7  0x0808f6ae in Digikam::ImageWindow::slotCollectionImageChange (
    this=0xaa31cac8, changeset=@0xa6ff1a88)
    at /home/build/digikam_4.1/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp:1184
#8  0x08096b1f in Digikam::ImageWindow::qt_metacall (this=0xaa31cac8,
    _c=QMetaObject::InvokeMetaMethod, _id=30, _a=0xa6ff1a78)
    at /home/build/digikam_4.1/graphics/build/digikam/digikam/imagewindow.moc:152
#9  0xb7e1517a in QMetaCallEvent::placeMetaCall ()
   from /usr/lib/qt4/libQtCore.so.4
#10 0xb7e1701d in QObject::event () from /usr/lib/qt4/libQtCore.so.4
#11 0xb5fa496a in QWidget::event () from /usr/lib/qt4/libQtGui.so.4
#12 0xb6312dd1 in QMainWindow::event () from /usr/lib/qt4/libQtGui.so.4
#13 0xb79aa1a0 in KMainWindow::event () from /usr/kde/4.1/lib/libkdeui.so.5
#14 0xaa31cac8 in ?? ()
#15 0xaa981670 in ?? ()
#16 0x00000000 in ?? ()
Comment 4 caulier.gilles 2008-12-01 12:58:01 UTC
Yann,

Thanks for the patch... It's sound fine for me...

Andi, What do you think about ?

Gilles

Comment 5 Andi Clemens 2008-12-01 13:09:48 UTC
Sounds ok, although I can not reproduce the crash here... moved my whole albums and images around, works like a charm.

Andi
Comment 6 Marcel Wiesweg 2008-12-01 19:22:41 UTC
SVN commit 891327 by mwiesweg:

Patch by Yann Le Hir:
Fix off-by-one error causing a crash when the last image is removed

CCBUG: 176472

 M  +1 -1      imagewindow.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=891327
Comment 7 Marcel Wiesweg 2008-12-01 19:32:50 UTC
Yann, you see that I committed one line of your patch that fixes a problem that can lead to a crash.

As to the rest of your patch:
If you remove index first, then index and not index+1 already points to the next entry. If you increment index, you get the entry two slots after the initial entry. Or am I mistaken?
Comment 8 Yann LE HIR 2008-12-01 20:00:18 UTC
Yes, you're right about my patch , I completly forgot about this index changing after a remove.
But with your patch the program will never delete the first element (id 0) of a list which has 1 element.

So maybe doing something like that :

d->urlList.removeAt(index);
if (!d->imageInfoList.isEmpty())
    d->imageInfoList.removeAt(index);

if (index < d->urlList.size())
{
    // Try to get the next image in the current Album...
    d->urlCurrent       = d->urlList[index];
    d->imageInfoCurrent = d->imageInfoList[index];
    return true;
}
else if(index - 1 >= 0)
{
    // Try to get the previous image in the current Album.
    --index;
    d->urlCurrent       = d->urlList[index];
    d->imageInfoCurrent = d->imageInfoList[index];
    return true;
}
Comment 9 Marcel Wiesweg 2008-12-01 21:21:08 UTC
SVN commit 891351 by mwiesweg:

Patch from Yann Le Hir:
The last element of a list of size 1 was never deleted.

CCBUG: 176472

 M  +7 -10     imagewindow.cpp  


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