Bug 121905

Summary: albums not displayed corectly and digikam crashes with St9bad_alloc
Product: [Applications] digikam Reporter: Felix Riedel <felix.riedel>
Component: Database-AlbumsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles, obsrv5
Priority: NOR    
Version: 0.8.1   
Target Milestone: ---   
Platform: FreeBSD Ports   
OS: FreeBSD   
Latest Commit: Version Fixed In: 0.9.0
Sentry Crash Report:
Attachments: Patch to fix wrong cast into digikam kioslave
Patch to fix wrong cast into digikam kioslave
Patch to fix wrong cast into digikam kioslave
Patch to fix wrong cast into digikam kioslave

Description Felix Riedel 2006-02-13 19:19:24 UTC
Version:           0.8.1 (using KDE KDE 3.5.1)
Installed from:    FreeBSD Ports
Compiler:          gcc version 3.4.4 [FreeBSD] 20050518 
OS:                FreeBSD

OS: FreeBSD 6.0-STABLE 

I used version 0.7.4 and it worked like a charm. 
Now i tried verions 0.8.0, 0.8.1 and 0.8.2 and i can't get it to work properly.

Here what happens:

1. start digikam 
2. select an Album
   - the album view shows only 1 image and a corrupted entry (e.g. w/ name "0:00") 
3. select another album
  -> digikam crashes 

the crash doesn't happen necessarily on the second album. it also crashes if i select the Tags pane on the left.

I tried to start w/ an empty database, deleted db files, deleted thumbs DB and started with an empty folder. i also removed all plugins. But I couldnt resolve the problem.
I imported images and looked at the created digikam3.db with sqlite3; this file looks fine. But for me it looks like a problem with reading the DB. Of course, this is just a guess and obviously there must be more wrong, otherwise it wouldn't end in a crash.


digikam output:

digikam: ScanLib: Finding non-existing Albums: 22 ms
digikam: ScanLib: Finding items not in the database or disk: 1333 ms
digikam: ScanLib: Updating items without date: 35 ms
digikam: ImagePlugin_Core plugin loaded
digikam: ImagePluginLoader: Loaded plugin ImagePlugin_Core
terminate called after throwing an instance of 'std::bad_alloc'
  what():  St9bad_alloc
KCrash: Application 'digikam' crashing.

----------------------------------------------------------------------------

[New LWP 100145]
[Switching to LWP 100145]
0x29b362f3 in nanosleep () from /lib/libc.so.6
#0  0x29b362f3 in nanosleep () from /lib/libc.so.6
#1  0x29a77d19 in _nanosleep () from /usr/lib/libpthread.so.2
#2  0x29b17aba in sleep () from /lib/libc.so.6
#3  0x29a6c47c in sleep () from /usr/lib/libpthread.so.2
#4  0x28ed92cc in KCrash::startDrKonqi () from /usr/local/lib/libkdecore.so.6
#5  0x28ed9653 in KCrash::defaultCrashHandler ()
   from /usr/local/lib/libkdecore.so.6
#6  0x29a751a8 in sigaction () from /usr/lib/libpthread.so.2
#7  0xbfbfff94 in ?? ()
#8  0x00000006 in ?? ()
#9  0xbfbfd130 in ?? ()
#10 0xbfbfce70 in ?? ()
#11 0x00000000 in ?? ()
#12 0x29a74810 in sigaction () from /usr/lib/libpthread.so.2
#13 0x29b4e02b in abort () from /lib/libc.so.6
#14 0x299dbfc7 in __gnu_cxx::__verbose_terminate_handler ()
   from /usr/lib/libstdc++.so.5
#15 0x299e0465 in __cxxabiv1::__terminate () from /usr/lib/libstdc++.so.5
#16 0x299e04a2 in std::terminate () from /usr/lib/libstdc++.so.5
#17 0x299e03d2 in __cxa_throw () from /usr/lib/libstdc++.so.5
#18 0x29a26b77 in operator new () from /usr/lib/libstdc++.so.5
#19 0x29a26aad in operator new[] () from /usr/lib/libstdc++.so.5
#20 0x295e5982 in QString::setLength () from /usr/X11R6/lib/libqt-mt.so.3
#21 0x295ee6f7 in operator>> () from /usr/X11R6/lib/libqt-mt.so.3
#22 0x281331d3 in AlbumLister::slotData () from /usr/local/lib/libdigikam.so.0
#23 0x28133673 in AlbumLister::qt_invoke ()
   from /usr/local/lib/libdigikam.so.0
#24 0x292fa144 in QObject::activate_signal ()
   from /usr/X11R6/lib/libqt-mt.so.3
#25 0x28763c09 in KIO::TransferJob::data () from /usr/local/lib/libkio.so.6
#26 0x28763c88 in KIO::TransferJob::slotData ()
   from /usr/local/lib/libkio.so.6
#27 0x2876586d in KIO::TransferJob::qt_invoke ()
   from /usr/local/lib/libkio.so.6
#28 0x292fa144 in QObject::activate_signal ()
   from /usr/X11R6/lib/libqt-mt.so.3
#29 0x2874f5ad in KIO::SlaveInterface::data () from /usr/local/lib/libkio.so.6
#30 0x28752012 in KIO::SlaveInterface::dispatch ()
   from /usr/local/lib/libkio.so.6
#31 0x28750ea3 in KIO::SlaveInterface::dispatch ()
   from /usr/local/lib/libkio.so.6
#32 0x2874cbdb in KIO::Slave::gotInput () from /usr/local/lib/libkio.so.6
#33 0x2874cfb8 in KIO::Slave::qt_invoke () from /usr/local/lib/libkio.so.6
#34 0x292fa144 in QObject::activate_signal ()
   from /usr/X11R6/lib/libqt-mt.so.3
#35 0x292fa76b in QObject::activate_signal ()
   from /usr/X11R6/lib/libqt-mt.so.3
#36 0x29653eb0 in QSocketNotifier::activated ()
   from /usr/X11R6/lib/libqt-mt.so.3
#37 0x29316ee0 in QSocketNotifier::event () from /usr/X11R6/lib/libqt-mt.so.3
#38 0x2929626f in QApplication::internalNotify ()
   from /usr/X11R6/lib/libqt-mt.so.3
#39 0x2929640c in QApplication::notify () from /usr/X11R6/lib/libqt-mt.so.3
#40 0x28e3a035 in KApplication::notify () from /usr/local/lib/libkdecore.so.6
#41 0x29289d23 in QEventLoop::activateSocketNotifiers ()
   from /usr/X11R6/lib/libqt-mt.so.3
#42 0x292419be in QEventLoop::processEvents ()
   from /usr/X11R6/lib/libqt-mt.so.3
#43 0x292acb11 in QEventLoop::enterLoop () from /usr/X11R6/lib/libqt-mt.so.3
#44 0x292aca66 in QEventLoop::exec () from /usr/X11R6/lib/libqt-mt.so.3
#45 0x292953df in QApplication::exec () from /usr/X11R6/lib/libqt-mt.so.3
#46 0x0804a49a in main ()

---------------------------------------------------------------------------------------
Information for digikam-0.8.1:

Depends on:
Dependency: xterm-206_1
Dependency: xorg-libraries-6.9.0
Dependency: xorg-fonts-truetype-6.9.0
Dependency: xorg-fonts-encodings-6.9.0
Dependency: expat-2.0.0
Dependency: tiff-3.8.0
Dependency: pkgconfig-0.20
Dependency: qt-3.3.5
Dependency: portaudio-18.1_2
Dependency: png-1.2.8_2
Dependency: sqlite-3.3.3
Dependency: perl-5.8.7_2
Dependency: pcre-6.5
Dependency: nas-1.7b
Dependency: mDNSResponder-107.1_2
Dependency: lua-5.0.2_1
Dependency: libxslt-1.1.15
Dependency: libxml2-2.6.23
Dependency: libvorbis-1.1.2,3
Dependency: libusb-0.1.10a_1
Dependency: libungif-4.1.4
Dependency: libsndfile-1.0.13
Dependency: libogg-1.1.3,3
Dependency: libmng-1.0.9
Dependency: libmad-0.15.1b_1
Dependency: libltdl-1.5.22
Dependency: aspell-0.60.4_2
Dependency: cups-base-1.1.23.0_8
Dependency: libidn-0.6.1
Dependency: libiconv-1.9.2_1
Dependency: libgphoto2-2.1.6_2
Dependency: libgpg-error-1.1
Dependency: libgcrypt-1.2.2
Dependency: libexif-0.6.12_1
Dependency: libdrm-2.0
Dependency: libaudiofile-0.2.6
Dependency: libart_lgpl2-2.3.17
Dependency: freetype2-2.1.10_2
Dependency: lcms-1.14,1
Dependency: OpenEXR-1.2.2_1
Dependency: kdehier-1.0_8
Dependency: jpeg-6b_3
Dependency: jasper-1.701.0
Dependency: jackit-0.100.0
Dependency: fontconfig-2.3.2_2,1
Dependency: gnutls-1.2.9
Dependency: glib-2.8.6
Dependency: gettext-0.14.5_1
Dependency: gamin-0.1.7_1
Dependency: libXft-2.1.7
Dependency: xorg-clients-6.9.0_1
Dependency: flac-1.1.2
Dependency: imlib2-1.2.1.010
Dependency: dcraw-8.00
Dependency: arts-1.5.1,1
Dependency: bitstream-vera-1.10_2
Dependency: kdelibs-3.5.1
Dependency: libkipi-0.1.2
Dependency: libkexif-0.2.2
Comment 1 Andreas Hermann Braml 2006-02-24 23:32:45 UTC
Same behaviour here, with digikam 0.8.1 (no imageplugins) and dependencies
from a portstree as of 2006-02-24 14:30 CET

Sorry that i cannot provide more than a "me too", but feel free to ask for
more information if needed :)
Comment 2 koen Vandenbroek 2006-03-06 17:52:32 UTC
Same behaviour on my PC
FreeBSD 6.0 Stable
KDE 3.5.1
Digikam 0.8.1

Crash if I click on a new album or open a new album
Comment 3 Thomas R. 2006-03-07 13:28:51 UTC
Same behaviour here:
only one picture is shown, crashes after clicking around for some time

FreeBSD 6.1-PRERELEASE
digikam-0.8.2
dcraw-8.05 
kde 3.5.1
Comment 4 Aaron Hunt 2006-03-23 02:56:46 UTC
Ditto:
1 photo in the startup album.  clicking another album crashes.  Earlier versions worked spectacularly.  Very impressive to this point... then nothing.  :(

I have the feeling that it is associated with KDE 3.5.1 somehow because that desktop seems to have some issues as well, and noticed that the other problem reports all have that desktop version.
Comment 5 jean-paul coulon 2006-03-23 15:05:56 UTC
So, I have same problem with kde3.4.0...did you got a solution ?
Comment 6 caulier.gilles 2006-03-23 15:12:36 UTC
try these patches provides by Marc Espie <espie@nerim.net> from OpenBSD team... These patches are already applied to trunk branch, not stable. Please give me a feedback...

Gilles Caulier
Comment 7 caulier.gilles 2006-03-23 15:15:48 UTC
Created attachment 15269 [details]
Patch to fix wrong cast into digikam kioslave
Comment 8 caulier.gilles 2006-03-23 15:16:29 UTC
Created attachment 15270 [details]
Patch to fix wrong cast into digikam kioslave
Comment 9 caulier.gilles 2006-03-23 15:16:57 UTC
Created attachment 15271 [details]
Patch to fix wrong cast into digikam kioslave
Comment 10 caulier.gilles 2006-03-23 15:17:20 UTC
Created attachment 15272 [details]
Patch to fix wrong cast into digikam kioslave
Comment 11 Gérard Milhaud 2006-03-26 01:58:31 UTC
Same behaviour FreeBSD 6.0 + DigiKam 0.8.1 (worked fine with 0.7.4). Only 1 image per album and crash almost immediatly if I select an album.
Comment 12 Gérard Milhaud 2006-03-26 03:45:36 UTC
WORKS fine with the patches attached here given by Gilles Caulier !!! Many many thanks to you, compatriote...,(and to Marc espie from OpenBSD team), your software is incredible and I was so disappointed since 2 months withouta running digikam on my FreeBSD home box. I will enjoy the 0.8x versions now with so many new features. Great !!! 
Comment 13 caulier.gilles 2006-03-26 09:27:37 UTC
SVN commit 522589 by cgilles:

Digikam from stable : Fix wrong cast into kioslave. This bug crash digikam during album item thumbs rendering or stop it to the first item of each album

Nota : these patch have been already applied to trunk branch (0.9.0-svn)

CCMAIL: digikam-devel@kde.org
CCBUGS: 121905


 M  +1 -1      digikamalbums.cpp  
 M  +1 -1      digikamdates.cpp  
 M  +1 -1      digikamsearch.cpp  
 M  +1 -1      digikamtags.cpp  


--- branches/stable/extragear/graphics/digikam/kioslave/digikamalbums.cpp #522588:522589
@@ -206,7 +206,7 @@
         os << albumid;
         os << name;
         os << date;
-        os << stbuf.st_size;
+        os << static_cast<size_t>(stbuf.st_size);
         os << dims;
     }
 
--- branches/stable/extragear/graphics/digikam/kioslave/digikamdates.cpp #522588:522589
@@ -248,7 +248,7 @@
                 *os << dirid;
                 *os << name;
                 *os << date;
-                *os << stbuf.st_size;
+                *os << static_cast<size_t>(stbuf.st_size);
                 *os << dims;
 
                 count++;
--- branches/stable/extragear/graphics/digikam/kioslave/digikamsearch.cpp #522588:522589
@@ -214,7 +214,7 @@
             *os << dirid;
             *os << name;
             *os << date;
-            *os << stbuf.st_size;
+            *os << static_cast<size_t>(stbuf.st_size);
             *os << dims;
 
             count++;
--- branches/stable/extragear/graphics/digikam/kioslave/digikamtags.cpp #522588:522589
@@ -193,7 +193,7 @@
         *os << dirid;
         *os << name;
         *os << date;
-        *os << stbuf.st_size;
+        *os << static_cast<size_t>(stbuf.st_size);
         *os << dims;
 
         count++;
Comment 14 caulier.gilles 2006-03-26 09:31:59 UTC
ok patch apply to stable and trunk branch. I can close this file now.

Gilles Caulier
Comment 15 caulier.gilles 2006-05-19 12:17:58 UTC
*** Bug 124905 has been marked as a duplicate of this bug. ***