Bug 131301 - Crash after add second image
Summary: Crash after add second image
Status: CLOSED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Scan (show other bugs)
Version: unspecified
Platform: FreeBSD Ports FreeBSD
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-24 18:11 UTC by Maxes
Modified: 2017-07-14 22:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.9.0


Attachments
Debug statements (1.65 KB, patch)
2006-07-25 15:12 UTC, Marcel Wiesweg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maxes 2006-07-24 18:11:59 UTC
Version:           0.9.0-beta1 (using KDE KDE 3.5.2)
Installed from:    FreeBSD Ports
Compiler:          gcc (GCC) 3.4.4 [FreeBSD] 20050518 -O0 -g 
OS:                FreeBSD

terminate called after throwing an instance of 'std::bad_alloc'
  what():  St9bad_alloc

Program received signal SIGABRT, Aborted.
0x29bcaf4b in kill () from /lib/libc.so.6
(gdb) bt
#0  0x29bcaf4b in kill () from /lib/libc.so.6
#1  0x29af0236 in raise () from /usr/lib/libpthread.so.2
#2  0x29bc9bfc in abort () from /lib/libc.so.6
#3  0x29a66027 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/libstdc++.so.5
#4  0x29a6a22c in __cxxabiv1::__terminate(void (*)()) ()
   from /usr/lib/libstdc++.so.5
#5  0x29a6a264 in std::terminate() () from /usr/lib/libstdc++.so.5
#6  0x29a6a1b8 in __cxa_throw () from /usr/lib/libstdc++.so.5
#7  0x29aa97ca in operator new(unsigned) () from /usr/lib/libstdc++.so.5
#8  0x29aa9713 in operator new[](unsigned) () from /usr/lib/libstdc++.so.5
#9  0x2959aaf2 in QString::setLength(unsigned) () from /usr/X11R6/lib/libqt-mt.so.3
#10 0x295a290e in operator>>(QDataStream&, QString&) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#11 0x28178596 in Digikam::AlbumLister::slotData(KIO::Job*, QMemArray<char> const&)
    () from /usr/local/lib/libdigikam.so.0
#12 0x281789d5 in Digikam::AlbumLister::qt_invoke(int, QUObject*) ()
   from /usr/local/lib/libdigikam.so.0
#13 0x292f71e0 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#14 0x288fdfcc in KIO::TransferJob::data(KIO::Job*, QMemArray<char> const&) ()
   from /usr/local/lib/libkio.so.6
#15 0x288fe030 in KIO::TransferJob::slotData(QMemArray<char> const&) ()
   from /usr/local/lib/libkio.so.6
#16 0x288ff5ad in KIO::TransferJob::qt_invoke(int, QUObject*) ()
   from /usr/local/lib/libkio.so.6
#17 0x292f71e0 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#18 0x288ec45b in KIO::SlaveInterface::data(QMemArray<char> const&) ()
   from /usr/local/lib/libkio.so.6
#19 0x288ef0fa in KIO::SlaveInterface::dispatch(int, QMemArray<char> const&) ()
   from /usr/local/lib/libkio.so.6
#20 0x288ed9f5 in KIO::SlaveInterface::dispatch() ()
   from /usr/local/lib/libkio.so.6
#21 0x288e9f64 in KIO::Slave::gotInput() () from /usr/local/lib/libkio.so.6
#22 0x288ea2c9 in KIO::Slave::qt_invoke(int, QUObject*) ()
   from /usr/local/lib/libkio.so.6
#23 0x292f71e0 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#24 0x292f7714 in QObject::activate_signal(int, int) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#25 0x295f8e85 in QSocketNotifier::activated(int) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#26 0x29310264 in QSocketNotifier::event(QEvent*) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#27 0x2929b265 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#28 0x2929b3fa in QApplication::notify(QObject*, QEvent*) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#29 0x28e75fc6 in KApplication::notify(QObject*, QEvent*) ()
   from /usr/local/lib/libkdecore.so.6
#30 0x2928fc1f in QEventLoop::activateSocketNotifiers() ()
   from /usr/X11R6/lib/libqt-mt.so.3
#31 0x2924db28 in QEventLoop::processEvents(unsigned) ()
   from /usr/X11R6/lib/libqt-mt.so.3
#32 0x292af627 in QEventLoop::enterLoop() () from /usr/X11R6/lib/libqt-mt.so.3
#33 0x292af580 in QEventLoop::exec() () from /usr/X11R6/lib/libqt-mt.so.3
#34 0x2929a5a0 in QApplication::exec() () from /usr/X11R6/lib/libqt-mt.so.3
#35 0x0804a756 in main (argc=1, argv=0xbfbfead4) at main.cpp:273
#36 0x08049e8e in _start ()


Start digikam. Add first image. Connect by gdb53 to process. 
Try add second image.

[madmax@solo ~]$ pkg_info  | grep kde 
kde-3.5.2           The "meta-port" for KDE
kdeaccessibility-3.5.2 Accessibility applications for KDE
kdeadmin-3.5.2      KDE applications related to system administration
kdeartwork-3.5.2    Additional themes, sounds, wallpapers and window styles for
kdebase-3.5.2_1     Basic applications for the KDE system
kdebase-kompmgr-3.5.2 Utility needed to enable XComposite support in KDE
kdeedu-3.5.2        Collection of entertaining, educational programs for KDE
kdegames-3.5.2      Games for the KDE integrated X11 desktop
kdegraphics-3.5.2   Graphics utilities for the KDE3 integrated X11 desktop
kdehier-1.0_9       Utility port which installs a hierarchy of shared KDE direc
kdelibs-3.5.1       Base set of libraries needed by KDE programs
kdemultimedia-3.5.2 Multimedia utilities for the KDE integrated X11 desktop
kdenetwork-3.5.2_1  Network-related programs and modules for KDE
kdepim-3.5.2        Personal Information Management tools for KDE
kdesdk-3.5.2        KDE Software Development Kit
kdetoys-3.5.2       Small applications for KDE
kdeutils-3.5.2      Utilities for the KDE integrated X11 desktop
kdevelop-3.3.2      IDE for a wide variety of programming tasks
kdewebdev-3.5.2,2   Comprehensive html/website development environment
[madmax@solo ~]$ pkg_info  | grep qt 
licq-qt-gui-1.3.2_1 Qt plugin for licq
qt-3.3.6_2          Multiplatform C++ application framework

FreeBSD 6.1-STABLE #4: Fri Jul 21 18:58:31 MSD 2006
Comment 1 Maxes 2006-07-24 18:40:09 UTC
sqlite3 dump:

INSERT INTO "Albums" VALUES(1, '/New Album', '2006-07-24', '', 'Uncategorized Album', NULL);
INSERT INTO "Images" VALUES(1, 'd2_0003.JPG', 1, '', '2006-07-17T21:25:30');
INSERT INTO "Images" VALUES(2, 'small_0011.JPG', 1, '', '2006-07-07T21:13:45');
INSERT INTO "Settings" VALUES('DBVersion', '1');
INSERT INTO "Settings" VALUES('Locale', 'ISO 8859-1');
INSERT INTO "Settings" VALUES('UpgradedFromSqlite2', 'yes');
INSERT INTO "Settings" VALUES('Scanned', '2006-07-24T20:28:27');

Comment 2 Maxes 2006-07-24 21:18:43 UTC
Update:
 installed from tgz, not from ports.
Comment 3 Marcel Wiesweg 2006-07-24 22:49:23 UTC
The crash happens when data sent from the albums ioslave is deserialized.
Please check that there are no old kde/3.5/lib/kde3/kio_digikamalbums.so libs lying around (although the format has not changed I think, so it shouldn't cause this).
Then, please recompile with --enable-debug so that the backtrace provides the source locations.
Comment 4 caulier.gilles 2006-07-25 07:52:05 UTC
Marcel,

This is certainly a duplicate of #121905. I have fixed it in the past. You have right... The problem is duing of a wrong cast in serialization data from kio-slave.

The Free-BSD team have reported this problem and provide patches, because we cannot reproduce it under linux (the cast depand of an internal libc data format witch is different of linux libc).

For more informations, I recommend to contact Marc Espie <espie@nerim.net> from FREE-BSD team witch have provide the #121905 patches.

Gilles Caulier
Comment 5 Maxes 2006-07-25 09:41:01 UTC
1) deinstall digikam and all related kio_ libs.
2) recomopiled with debug full
3) install
4) rm ~/.thumbnails and ~/Pictures
5) run first time, make new album, add one jpg. Add second jpg and catch crash
6) run under gdb
 

terminate called after throwing an instance of 'std::bad_alloc'
  what():  St9bad_alloc

Program received signal SIGABRT, Aborted.
0x29b9cf4b in kill () from /lib/libc.so.6
(gdb) bt
#0  0x29b9cf4b in kill () from /lib/libc.so.6
#1  0x29ac2236 in raise () from /usr/lib/libpthread.so.2
#2  0x29b9bbfc in abort () from /lib/libc.so.6
#3  0x29a38027 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.5
#4  0x29a3c22c in __cxxabiv1::__terminate(void (*)()) () from /usr/lib/libstdc++.so.5
#5  0x29a3c264 in std::terminate() () from /usr/lib/libstdc++.so.5
#6  0x29a3c1b8 in __cxa_throw () from /usr/lib/libstdc++.so.5
#7  0x29a7b7ca in operator new(unsigned) () from /usr/lib/libstdc++.so.5
#8  0x29a7b713 in operator new[](unsigned) () from /usr/lib/libstdc++.so.5
#9  0x2956caf2 in QString::setLength(unsigned) () from /usr/X11R6/lib/libqt-mt.so.3
#10 0x2957490e in operator>>(QDataStream&, QString&) () from /usr/X11R6/lib/libqt-mt.so.3
#11 0x281967d2 in Digikam::AlbumLister::slotData(KIO::Job*, QMemArray<char> const&) (this=0x815f600, 
    data=@0xbfbfdea0) at albumlister.cpp:338
#12 0x28196b96 in Digikam::AlbumLister::qt_invoke(int, QUObject*) (this=0x815f600, _id=695136572, 
    _o=0xbfbfdf70) at albumlister.moc:191
#13 0x292c91e0 in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/X11R6/lib/libqt-mt.so.3
#14 0x288c6fcc in KIO::TransferJob::data(KIO::Job*, QMemArray<char> const&) () from /usr/local/lib/libkio.so.6
#15 0x288c7030 in KIO::TransferJob::slotData(QMemArray<char> const&) () from /usr/local/lib/libkio.so.6
#16 0x288c85ad in KIO::TransferJob::qt_invoke(int, QUObject*) () from /usr/local/lib/libkio.so.6
#17 0x292c91e0 in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/X11R6/lib/libqt-mt.so.3
#18 0x288b545b in KIO::SlaveInterface::data(QMemArray<char> const&) () from /usr/local/lib/libkio.so.6
#19 0x288b80fa in KIO::SlaveInterface::dispatch(int, QMemArray<char> const&) () from /usr/local/lib/libkio.so.6
#20 0x288b69f5 in KIO::SlaveInterface::dispatch() () from /usr/local/lib/libkio.so.6
#21 0x288b2f64 in KIO::Slave::gotInput() () from /usr/local/lib/libkio.so.6
#22 0x288b32c9 in KIO::Slave::qt_invoke(int, QUObject*) () from /usr/local/lib/libkio.so.6
#23 0x292c91e0 in QObject::activate_signal(QConnectionList*, QUObject*) () from /usr/X11R6/lib/libqt-mt.so.3
#24 0x292c9714 in QObject::activate_signal(int, int) () from /usr/X11R6/lib/libqt-mt.so.3
#25 0x295cae85 in QSocketNotifier::activated(int) () from /usr/X11R6/lib/libqt-mt.so.3
#26 0x292e2264 in QSocketNotifier::event(QEvent*) () from /usr/X11R6/lib/libqt-mt.so.3
#27 0x2926d265 in QApplication::internalNotify(QObject*, QEvent*) () from /usr/X11R6/lib/libqt-mt.so.3
#28 0x2926d3fa in QApplication::notify(QObject*, QEvent*) () from /usr/X11R6/lib/libqt-mt.so.3
#29 0x28e47fc6 in KApplication::notify(QObject*, QEvent*) () from /usr/local/lib/libkdecore.so.6
#30 0x29261c1f in QEventLoop::activateSocketNotifiers() () from /usr/X11R6/lib/libqt-mt.so.3
#31 0x2921fb28 in QEventLoop::processEvents(unsigned) () from /usr/X11R6/lib/libqt-mt.so.3
#32 0x29281627 in QEventLoop::enterLoop() () from /usr/X11R6/lib/libqt-mt.so.3
#33 0x29281580 in QEventLoop::exec() () from /usr/X11R6/lib/libqt-mt.so.3
#34 0x2926c5a0 in QApplication::exec() () from /usr/X11R6/lib/libqt-mt.so.3
#35 0x0804a756 in main ()
#36 0x08049e8e in _start ()

p.s.
 as I can see, patches from #121905 already applied to 0.9.0-beta1
Comment 6 caulier.gilles 2006-07-25 09:46:39 UTC
Yes, patches from #121905 have already applied to 0.9.0-beta1. I suspect others wrong cast in kio-slave witch crash digiKam only under FreeBSD. In fact, something is different in libc Freebsd port and libc from Linux.

I cannot debug digiKam under freebsd, sorry. Please report this problem to freebsd team to make a little patch. Like the problem is know, it will be easy to hack this point check old patches.

Thanks in advance

Gilles Caulier
Comment 7 Marcel Wiesweg 2006-07-25 15:12:26 UTC
Created attachment 17125 [details]
Debug statements

You might want to try this patch to get more debug output, and to try to find
the exact location of the problem.

You need to make install after compiling (kioslave is changed), and one part of
the debug output will be found in your ~/.xsession-errors (from the kioslave,
again)
Comment 8 Maxes 2006-07-25 19:03:12 UTC
digikam: Read albumID 4
digikam: Read name IMG_2017.JPG
digikam: Read date 2006-06-11T17:12:51
digikam: Read size 8
digikam: Read dims

kio_digikamalbums: -- Adding ID 8 8
kio_digikamalbums: Adding albumid 4 12
kio_digikamalbums: Adding name IMG_2017.JPG 40
kio_digikamalbums: Adding date 2006-06-11T17:12:51 82
kio_digikamalbums: Adding st_size 4 86
kio_digikamalbums: Adding dims 94

kio_digikamalbums: -- Adding ID 8 8
kio_digikamalbums: Adding albumid 4 12
kio_digikamalbums: Adding name IMG_2017.JPG 40
kio_digikamalbums: Adding date 2006-06-11T17:12:51 82
kio_digikamalbums: Adding st_size 4 86
kio_digikamalbums: Adding dims 94

digikam: -- Read imageID 8
digikam: Read albumID 4
digikam: Read name IMG_2017.JPG
digikam: Read date 2006-06-11T17:12:51
digikam: Read size 8
digikam: Read dims

kio_digikamalbums: -- Adding ID 8 8
kio_digikamalbums: Adding albumid 4 12
kio_digikamalbums: Adding name IMG_2017.JPG 40
kio_digikamalbums: Adding date 2006-06-11T17:12:51 82
kio_digikamalbums: Adding st_size 4 86
kio_digikamalbums: Adding dims 94

kio_digikamalbums: -- Adding ID 8 102
kio_digikamalbums: Adding albumid 4 106
kio_digikamalbums: Adding name IMG_2132.JPG 134
kio_digikamalbums: Adding date 2006-06-18T13:00:26 176
kio_digikamalbums: Adding st_size 4 180
kio_digikamalbums: Adding dims 188

digikam: -- Read imageID 8
digikam: Read albumID 4
digikam: Read name IMG_2017.JPG
digikam: Read date 2006-06-11T17:12:51
digikam: Read size 8
digikam: Read dims
digikam: -- Read imageID 8
digikam: Read albumID 4
digikam: Read name G_2132.JPGterminate called after throwing an instance of 'std::bad_alloc'
  what():  St9bad_alloc
KCrash: Application 'digikam' crashing...


where is first 2 char from second filename ? "G_2132.JPG"
Comment 9 Marcel Wiesweg 2006-07-25 22:31:23 UTC
The kioslave writes 4 bytes for "st_size", albumlister is reading 8 bytes, and attempting to read the string one byte off is fatal.

Could you please change digikam/albumlister.cpp, line 326
    off_t  size;
to
    size_t  size;

Perhaps off_t has 8 bytes on FreeBSD.
Comment 10 caulier.gilles 2006-07-26 07:23:18 UTC
Marcel,

This is exactly the problem. i remember to have talk about this point (in French) with Marc Espie from FreeBSD team on B.K.O file #121905. Making a cast solve the problem.

Gilles
Comment 11 caulier.gilles 2006-07-26 07:23:58 UTC
Marcel,

This is exactly the problem. i remember to have talk about this point (in French) with Marc Espie from FreeBSD team on B.K.O file #121905. Using the right data format solve the problem.

Gilles
Comment 12 Maxes 2006-07-26 10:04:00 UTC
-off_t
+size_t 
fixed problem, tnks
Comment 13 caulier.gilles 2006-07-26 10:11:16 UTC
SVN commit 566463 by cgilles:

digikam from trunk : fix crash under FreeBsd

CCBUGS: 131301


 M  +1 -1      albumlister.cpp  


--- trunk/extragear/graphics/digikam/digikam/albumlister.cpp #566462:566463
@@ -323,7 +323,7 @@
     int     albumID;
     QString name;
     QString date;
-    off_t   size;
+    size_t  size;
     QSize   dims;
 
     ImageInfoList newItemsList;
Comment 14 caulier.gilles 2006-07-26 10:17:27 UTC
SVN commit 566465 by cgilles:

digikam from stable: fix crash under FreeBsd
BUG: 131301


 M  +1 -1      albumlister.cpp  


--- branches/stable/extragear/graphics/digikam/digikam/albumlister.cpp #566464:566465
@@ -313,7 +313,7 @@
     int     albumID;
     QString name;
     QString date;
-    off_t   size;
+    size_t  size;
     QSize   dims;
 
     ImageInfoList newItemsList;