Bug 166424 - Crash when editing Caption with digiKam
Summary: Crash when editing Caption with digiKam
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Engine (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-13 04:15 UTC by Geoff King
Modified: 2021-05-04 10:16 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.3.0
Sentry Crash Report:


Attachments
libkexiv2 for KDE3 patch to force to initialize XMP parser in private class constructor (403 bytes, patch)
2008-07-19 10:01 UTC, caulier.gilles
Details
libkexiv2 for KDE4 patch to force to initialize XMP parser in private class constructor (490 bytes, patch)
2008-07-19 10:05 UTC, caulier.gilles
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Geoff King 2008-07-13 04:15:03 UTC
Version:           0.10.0-beta2 (rev.: 831370) (using KDE 4.0.83)
Installed from:    Ubuntu Packages
Compiler:          gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7) 
OS:                Linux

Crashed after clicking the edit button while on a jpeg file. Was able to re-create once, but not a third time. 

A backtrace is attached:

Application: digiKam (digikam), signal SIGSEGV
[Thread debugging using libthread_db enabled]
[New Thread 0xb4b32720 (LWP 5200)]
[New Thread 0xa9105b90 (LWP 5252)]
[New Thread 0xaab8ab90 (LWP 5250)]
[New Thread 0xab38bb90 (LWP 5249)]
[New Thread 0xac335b90 (LWP 5218)]
[New Thread 0xacbb1b90 (LWP 5217)]
[New Thread 0xad45db90 (LWP 5216)]
[New Thread 0xadc5eb90 (LWP 5214)]
[New Thread 0xae86ab90 (LWP 5211)]
[New Thread 0xaf06bb90 (LWP 5210)]
[New Thread 0xaf909b90 (LWP 5207)]
[New Thread 0xb299ab90 (LWP 5206)]
[New Thread 0xb2199b90 (LWP 5205)]
[New Thread 0xb3595b90 (LWP 5202)]
[KCrash handler]
#6  0xb4ea7f9b in std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::_M_insert_unique () from /usr/local/lib/libexiv2.so.4
#7  0xb4ea833b in std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::_M_insert_unique () from /usr/local/lib/libexiv2.so.4
#8  0xb4ebd867 in XMPMeta::RegisterNamespace ()
   from /usr/local/lib/libexiv2.so.4
#9  0xb4ebe0ee in XMPMeta::Initialize () from /usr/local/lib/libexiv2.so.4
#10 0xb4ee31e5 in WXMPMeta_Initialize_1 () from /usr/local/lib/libexiv2.so.4
#11 0xb4eb41c4 in TXMPMeta<std::string>::Initialize ()
   from /usr/local/lib/libexiv2.so.4
#12 0xb4eacee8 in Exiv2::XmpParser::initialize ()
   from /usr/local/lib/libexiv2.so.4
#13 0xb4eadf2f in Exiv2::XmpParser::registerNs ()
   from /usr/local/lib/libexiv2.so.4
#14 0xb4eabae1 in Exiv2::XmpProperties::registerNs ()
   from /usr/local/lib/libexiv2.so.4
#15 0xb5680de0 in KExiv2Priv (this=0xcb1b378)
    at /home/gsking/programs/src/digikam4/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2private.cpp:40
#16 0xb567debd in KExiv2 (this=0xbfbd39d0)
    at /home/gsking/programs/src/digikam4/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp:39
#17 0xb7c69e87 in DMetadata (this=0xbfbd39d0)
    at /home/gsking/programs/src/digikam4/graphics/digikam/libs/dmetadata/dmetadata.cpp:55
#18 0xb7d633bc in Digikam::ExifWidget::loadFromURL (this=0xcaffc88, 
    url=@0xbfbd3aa8)
    at /home/gsking/programs/src/digikam4/graphics/digikam/libs/widgets/metadata/exifwidget.cpp:113
#19 0xb7d8f809 in Digikam::ImagePropertiesMetaDataTab::setCurrentURL (
    this=0xcafd378, url=@0xbfbd3aa8)
    at /home/gsking/programs/src/digikam4/graphics/digikam/libs/imageproperties/imagepropertiesmetadatatab.cpp:149
#20 0xb7d83dd4 in Digikam::ImagePropertiesSideBar::slotNoCurrentItem (
    this=0xca7ce30)
    at /home/gsking/programs/src/digikam4/graphics/digikam/libs/imageproperties/imagepropertiessidebar.cpp:112
#21 0x080bec2a in Digikam::ImagePropertiesSideBarDB::slotNoCurrentItem (
    this=0xca7ce30)
    at /home/gsking/programs/src/digikam4/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:180
#22 0x080bf89a in Digikam::ImagePropertiesSideBarDB::qt_metacall (
    this=0xca7ce30, _c=QMetaObject::InvokeMetaMethod, _id=13, _a=0xbfbd3b88)
    at /home/gsking/programs/src/digikam4/graphics/build/digikam/digikam/imagepropertiessidebardb.moc:110
#23 0xb672d4f9 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#24 0xb672dbc2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#25 0xb7dddaef in Digikam::EditorWindow::signalNoCurrentItem (this=0x85e1058)
    at /home/gsking/programs/src/digikam4/graphics/build/digikam/digikam/editorwindow.moc:222
#26 0xb7dddc3a in Digikam::EditorWindow::slotLoadingStarted (this=0x85e1058)
    at /home/gsking/programs/src/digikam4/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp:1247
#27 0xb7dde3bb in Digikam::EditorWindow::qt_metacall (this=0x85e1058, 
    _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0xbfbd3d1c)
    at /home/gsking/programs/src/digikam4/graphics/build/digikam/digikam/editorwindow.moc:170
#28 0x080af914 in Digikam::ImageWindow::qt_metacall (this=0x85e1058, 
    _c=QMetaObject::InvokeMetaMethod, _id=61, _a=0xbfbd3d1c)
    at /home/gsking/programs/src/digikam4/graphics/build/digikam/digikam/imagewindow.moc:103
#29 0xb672d4f9 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#30 0xb672dbc2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#31 0xb7dc2a6c in Digikam::Canvas::signalLoadingStarted (this=0x85b0ef8, 
    _t1=@0xbfbd3d6c)
    at /home/gsking/programs/src/digikam4/graphics/build/digikam/digikam/canvas.moc:252
#32 0xb7dc3680 in Digikam::Canvas::load (this=0x85b0ef8, filename=@0xbfbd3d6c, 
    IOFileSettings=0xca67fd0)
    at /home/gsking/programs/src/digikam4/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp:252
#33 0x080adee4 in Digikam::ImageWindow::slotLoadCurrent (this=0x85e1058)
    at /home/gsking/programs/src/digikam4/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp:567
#34 0x080afa5e in Digikam::ImageWindow::qt_metacall (this=0x85e1058, 
    _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0xbfbd3e08)
    at /home/gsking/programs/src/digikam4/graphics/build/digikam/digikam/imagewindow.moc:118
#35 0xb672d4f9 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#36 0xb672dbc2 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#37 0xb6734037 in ?? () from /usr/lib/libQtCore.so.4
#38 0xb673415c in ?? () from /usr/lib/libQtCore.so.4
#39 0xb6728c9a in QObject::event () from /usr/lib/libQtCore.so.4
#40 0xb590fc0c in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
#41 0xb59147a9 in QApplication::notify () from /usr/lib/libQtGui.so.4
#42 0xb74e1d93 in KApplication::notify (this=0xbfbd45a4, receiver=0xe7cb230, 
    event=0xbfbd42e8)
    at /build/buildd/kde4libs-4.0.83/kdeui/kernel/kapplication.cpp:311
#43 0xb67186a9 in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
#44 0xb67461a1 in ?? () from /usr/lib/libQtCore.so.4
#45 0xb6743a40 in ?? () from /usr/lib/libQtCore.so.4
#46 0xb5072bf8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#47 0xb5075e5e in ?? () from /usr/lib/libglib-2.0.so.0
#48 0xb50763ac in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#49 0xb6743f98 in QEventDispatcherGlib::processEvents ()
   from /usr/lib/libQtCore.so.4
#50 0xb59a31b5 in ?? () from /usr/lib/libQtGui.so.4
#51 0xb671792d in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#52 0xb6717abd in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#53 0xb6719d3d in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#54 0xb590f567 in QApplication::exec () from /usr/lib/libQtGui.so.4
#55 0x082920bf in main (argc=1, argv=0xbfbd4974)
    at /home/gsking/programs/src/digikam4/graphics/digikam/digikam/main.cpp:298
#0  0xb7f98410 in __kernel_vsyscall ()
Comment 1 Andi Clemens 2008-07-13 10:11:19 UTC
Do you have the newest exiv2 (0.17.1) and libkexiv2 installed? Especially libkexiv2 has seen recent updates...
Comment 2 caulier.gilles 2008-07-13 10:26:48 UTC
Crash appears in Exiv2 thrue libkexiv2 when Microsoft XMP Namespace is registered...

We need to know exactly which version of EXiv2 you use.

I remember to have seen this crash in pass using EXiv2 0.17. updated Exiv2 to 0.17.1 fix the problem (i hope). I cannot reproduce it with Exiv2 from trunk (future 0.18)

Gilles Caulier
Comment 3 caulier.gilles 2008-07-13 10:29:09 UTC
Andreas, I CC you just for info.

Gilles Caulier
Comment 4 Andreas Huggel 2008-07-13 16:10:21 UTC
The crash happens in the initialization function of the Adobe XMP toolkit.

Just curious: could it be that two threads are calling this at (almost) the same time? (Even if that's the case, I have no idea whether that's a problem. But if it really is, you could easily initialize the XMP SDK somewhere suitable by explicitly calling Exiv2::XmpParser::initialize() )

-ahu.
Comment 5 caulier.gilles 2008-07-13 17:18:37 UTC
Andreas,

Yes, it's possible, because we using multithreading in digiKam.

Exiv2::XmpParser::initialize() need to be called in libkexiv2 constructor. right ?

Gilles
Comment 6 Andreas Huggel 2008-07-13 17:29:03 UTC
I don't know whether the constructor is the right place or a separate initialize() function or some kind of thread-synchronization would be required: "somewhere suitable" just means somewhere where you're sure that only one thread is doing this.

(just to highlight again: I really have no idea if this is the problem)

-ahu.
Comment 7 Marcel Wiesweg 2008-07-13 18:03:16 UTC
If there are global data fields somewhere inside the library that need to be initialized once and are then read-only, we should call this from our initialization code.
Assuming that the data is only accessed "const" afterwards it should be safe to leave it open for concurrent access (*).
If accessing the data involves any kind of change to global variables, and a mutex is not used, this would taint libexiv2 as "not reentrant" and require a mutex for access. I assume this is not the case.

(*) With Qt, there is an implication with implicitly shared classes: If there are copies of a QString, with several threads each having an instance copied from the same QString, everything is all right. However the process of creating the copies is not safe: Imagine a globally accessible QString and two threads at the same time copying it with the copy constructor. This is _not_ safe and should lege artis be mutex-protected. It is safe to create instances and send them with cross-thread signals.
Comment 8 Geoff King 2008-07-13 19:16:45 UTC
I'm using Exiv2 0.17.1
>We need to know exactly which version of EXiv2 you use. 

Comment 9 Andreas Huggel 2008-07-14 14:28:19 UTC
Marcel,

Exiv2 is only _almost_ thread-safe:

The IPTC code is reentrant

The Exif code will be reentrant in 0.18 (fix for #439 is in SVN). Current versions still have some hidden unprotected Makernote initialization code done in the constructor of static class variables, which is probably not safe.

The XMP code uses the Adobe XMP toolkit (XMP SDK), which according to its documentation is thread-safe. It actually uses mutexes to serialize critical sections. However, I just saw that the XMP SDK initialization function is not mutex protected, so I believe that it is not thread-safe. In addition, Exiv2::XmpProperties::registerNs is also not thread-safe. So at least for the time being, applications need to ensure that these two XMP functions are serialized.
Comment 10 caulier.gilles 2008-07-14 20:01:22 UTC
*** Bug 166557 has been marked as a duplicate of this bug. ***
Comment 11 caulier.gilles 2008-07-19 10:01:15 UTC
Created attachment 26252 [details]
libkexiv2 for KDE3 patch to force to initialize XMP parser in private class constructor
Comment 12 caulier.gilles 2008-07-19 10:05:57 UTC
Created attachment 26253 [details]
libkexiv2 for KDE4 patch to force to initialize XMP parser in private class constructor

Andi, Arnd, Marcel,

See attached 2 patches to force XMP initialization when libkexiv2 private
internal class is created. This will not solve the problem but it will set when
the XMP parser must be initialized. In old code, this is not set explicitly,
and it's done in Exiv2 when XMPParser class is used. With these patches we
control fine when and where initialization must be done.

Gilles Caulier
Comment 13 caulier.gilles 2008-07-27 13:21:19 UTC
SVN commit 838242 by cgilles:

force to initialize XMP parser in private class constructor
CCBUGS: 166424


 M  +3 -0      kexiv2private.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=838242
Comment 14 caulier.gilles 2008-07-27 13:24:32 UTC
Comment on attachment 26252 [details]
libkexiv2 for KDE3 patch to force to initialize XMP parser in private class constructor

This one must not be applied to svn for the moment.
Comment 15 caulier.gilles 2008-07-27 13:27:45 UTC
Geoff,

Please, make for me 2 test : 

- checkout libkexiv2 from trunk and compile it again used Exiv2 0.17.1, and check if crash still here.

- If it always crash, checkout Exiv2 from trunk (next 0.18.0 version). Cleanup libkexiv2 and recompile it using this Exiv2 version. Check if problem still here.

Thanks in advance

Gilles Caulier
Comment 16 Geoff King 2008-07-28 04:04:37 UTC
I tried your test and it seems okay using Exiv2 0.17.1
I'll continue to test. 
Thanks.
Comment 17 caulier.gilles 2008-07-29 11:02:31 UTC
Geoff,

With Exiv2 0.18 (current svn implementation) i have already registered Microsoft XMP namespace which crash Exiv2 from a non re-entrant call from kexiv2 private internal call to XMP sdk registration method. This will solve your problem.

Andreas,

This solution is just a specific fix. the real problem of non re-entrancy of XMP SDK toolkit is not solved. If somebody use Exiv2 with multi-threading and call the namespace registration method, there is a risk to have a crash...

Best

Gilles Caulier

Comment 18 Andreas Huggel 2008-07-29 11:42:54 UTC
Gilles,

Agreed. I reopened bug #439 - http://dev.robotbattle.com/bugs/view.php?id=439 - because of that.

-ahu.
 
Comment 19 Geoff King 2008-07-29 14:20:19 UTC
I'll be on vacation for the rest of the week, and will be able to try 0.18 SVN next week. Thanks, Geoff
Comment 20 caulier.gilles 2008-07-30 09:06:03 UTC
Andreas,

Non-reentrancy crash still reproductible here using Exiv2 from trunk. This is very easy to reproduce:

1/ open digiKam editor with items including XMP metadata.
2/ open metadata right sidebar.
3/ change speedly the focus on current image.

This problem is very critical for me...

Best

Gilles

Comment 21 caulier.gilles 2008-07-30 09:08:30 UTC
Andreas,

Just a remark: On comment #16, Geoff said that problem cannot be reproduce with Exiv2 0.17.1. I'm just surprized... XMP sdk toolkit is the same code between 0.17.1 and 0.18. The crash must be reproducible i think. right ?

Gilles
Comment 22 Andreas Huggel 2008-07-30 11:20:26 UTC
Re Comment #20: Do you get exactly the same backtrace? I'm thinking that shouldn't be the case. With the solution suggested by Marcel in Comment #7, the call to Exiv2::XmpProperties::registerNs (#14 in the original backtrace) would be from digiKam's initialization code _only_ (Exiv2 doesn't call this function internally). If it's a different backtrace, please post it.
Comment 23 Andreas Huggel 2008-07-30 11:27:25 UTC
Re Comment #21: Yes, the XMP implementation (XMP-SDK and Exiv2 XMP code on top of it) is practically identical (except for the namespaces that you just added)
Comment 24 caulier.gilles 2008-07-30 12:06:18 UTC
Andreas,

Yes it sound like the same:

gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Exited normally(gdb) quitgdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Quit
(gdb) quitquit
The program is running.  Exit anyway? (y or n) [answered Y; input not from terminal]
(gdb) Process exited
gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(gdb) bt
bt
#0  0xb51abfe7 in std::_Rb_tree<std::string, std::pair<std::string const, Exiv2::XmpNsInfo>, std::_Select1st<std::pair<std::string const, Exiv2::XmpNsInfo> >, std::less<std::string>, std::allocator<std::pair<std::string const, Exiv2::XmpNsInfo> > >::_M_insert_unique () from /usr/lib/libexiv2.so.4
#1  0xb51a9275 in Exiv2::XmpProperties::registerNs () from /usr/lib/libexiv2.so.4
#2  0xb5cf774d in KExiv2Priv (this=0xb1bb7a20) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2private.cpp:43
#3  0xb5cf378b in KExiv2 (this=0xbfee602c) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp:39
#4  0xb6b3adc5 in DMetadata (this=0xbfee602c) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:55
#5  0xb6c28178 in Digikam::ExifWidget::loadFromURL (this=0xb198cc58, url=@0xbfee60f8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/widgets/metadata/exifwidget.cpp:113
#6  0xb6c55a55 in Digikam::ImagePropertiesMetaDataTab::setCurrentURL (this=0xb198afd0, url=@0xbfee60f8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiesmetadatatab.cpp:149
#7  0xb6c4a1dc in Digikam::ImagePropertiesSideBar::slotNoCurrentItem (this=0xb1956438) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebar.cpp:112
#8  0x080b5fa0 in Digikam::ImagePropertiesSideBarDB::slotNoCurrentItem (this=0xb1956438) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:180
#9  0x080b6c10 in Digikam::ImagePropertiesSideBarDB::qt_metacall (this=0xb1956438, _c=QMetaObject::InvokeMetaMethod, _id=13, _a=0xbfee61f0) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagepropertiessidebardb.moc:109
#10 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4

To reproduce open digiKam with Histogram visible on right sidebar. open image in editor and cange current image using thumbbar. From album gui, the icon view focus will follow image editor focus and load reduce version of image to compute histogram from a separate thread and ping Exiv2. At the same time, editor will load full image to another separate thread and ping also Eviv2. You need to stress indeep the interface to see the crash. To process, i use these pictures from Vista which have XMP metadata : 

http://digikam3rdparty.free.fr/TEST_IMAGES/METADATA/Vista/

Gilles
Comment 25 caulier.gilles 2008-07-30 12:12:04 UTC
Andreas,

>With the solution suggested by Marcel in Comment #7, the call to >Exiv2::XmpProperties::registerNs (#14 in the original backtrace) would be from >digiKam's initialization code _only_ (Exiv2 doesn't call this function >internally). If it's a different backtrace, please post it. 

Oups, sorry but i have forget to update and recompile libkexiv2 on my current computer (i have more than one). In current libkexiv2 code, i have removed M$ namespace registration because it exist now in Exiv2 core.

I will try again

Gilles
Comment 26 caulier.gilles 2008-07-30 12:22:51 UTC
Andreas,

Ah, now, the crash is at a different place :

gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Exited normally(gdb) quitgdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Quit
(gdb) quitquit
The program is running.  Exit anyway? (y or n) [answered Y; input not from terminal]
(gdb) Process exited
gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(gdb) bt
bt
#0  0xb51abfe7 in std::_Rb_tree<std::string, std::pair<std::string const, Exiv2::XmpNsInfo>, std::_Select1st<std::pair<std::string const, Exiv2::XmpNsInfo> >, std::less<std::string>, std::allocator<std::pair<std::string const, Exiv2::XmpNsInfo> > >::_M_insert_unique () from /usr/lib/libexiv2.so.4
#1  0xb51a9275 in Exiv2::XmpProperties::registerNs () from /usr/lib/libexiv2.so.4
#2  0xb5cf774d in KExiv2Priv (this=0xb1bb7a20) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2private.cpp:43
#3  0xb5cf378b in KExiv2 (this=0xbfee602c) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp:39
#4  0xb6b3adc5 in DMetadata (this=0xbfee602c) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:55
#5  0xb6c28178 in Digikam::ExifWidget::loadFromURL (this=0xb198cc58, url=@0xbfee60f8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/widgets/metadata/exifwidget.cpp:113
#6  0xb6c55a55 in Digikam::ImagePropertiesMetaDataTab::setCurrentURL (this=0xb198afd0, url=@0xbfee60f8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiesmetadatatab.cpp:149
#7  0xb6c4a1dc in Digikam::ImagePropertiesSideBar::slotNoCurrentItem (this=0xb1956438) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebar.cpp:112
#8  0x080b5fa0 in Digikam::ImagePropertiesSideBarDB::slotNoCurrentItem (this=0xb1956438) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:180
#9  0x080b6c10 in Digikam::ImagePropertiesSideBarDB::qt_metacall (this=0xb1956438, _c=QMetaObject::InvokeMetaMethod, _id=13, _a=0xbfee61f0) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagepropertiessidebardb.moc:109
#10 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#11 0xb7f56fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#12 0xb6ca3e63 in Digikam::EditorWindow::signalNoCurrentItem (this=0xaad02588) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/editorwindow.moc:221
#13 0xb6ca3fae in Digikam::EditorWindow::slotLoadingStarted (this=0xaad02588) at /mnt/data/devel/SVN/trunk/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp:1244
#14 0xb6ca4779 in Digikam::EditorWindow::qt_metacall (this=0xaad02588, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0xbfee6bbc) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/editorwindow.moc:169
#15 0x080a6a2a in Digikam::ImageWindow::qt_metacall (this=0xaad02588, _c=QMetaObject::InvokeMetaMethod, _id=60, _a=0xbfee6bbc) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagewindow.moc:102
#16 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#17 0xb7f56fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#18 0xb6c88e1c in Digikam::Canvas::signalLoadingStarted (this=0xaad01e68, _t1=@0xbfee6c08) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/canvas.moc:251
#19 0xb6c89a38 in Digikam::Canvas::load (this=0xaad01e68, filename=@0xbfee6c08, IOFileSettings=0xb19b1078) at /mnt/data/devel/SVN/trunk/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp:252
#20 0x080a4ffa in Digikam::ImageWindow::slotLoadCurrent (this=0xaad02588) at /mnt/data/devel/SVN/trunk/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp:538
#21 0x080a6b74 in Digikam::ImageWindow::qt_metacall (this=0xaad02588, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0xbfee6cb0) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagewindow.moc:117
#22 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#23 0xb7f56fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#24 0xb7f5c1c5 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#25 0xb7f5c20c in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#26 0xb7f532b5 in QObject::event () from /usr/lib/qt4/lib/libQtCore.so.4
#27 0xb6ede1c2 in QApplicationPrivate::notify_helper () from /usr/lib/qt4/lib/libQtGui.so.4
#28 0xb6ee4781 in QApplication::notify () from /usr/lib/qt4/lib/libQtGui.so.4
#29 0xb7a09281 in KApplication::notify () from /opt/kde4/lib/libkdeui.so.5
#30 0xb7f44378 in QCoreApplication::notifyInternal () from /usr/lib/qt4/lib/libQtCore.so.4
#31 0xb7f6768f in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#32 0xb7f688b8 in QEventDispatcherUNIX::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#33 0xb6f5a9a3 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtGui.so.4
#34 0xb7f437e3 in QEventLoop::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#35 0xb7f438ea in QEventLoop::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#36 0xb7f45c46 in QCoreApplication::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#37 0xb6edd884 in QApplication::exec () from /usr/lib/qt4/lib/libQtGui.so.4
#38 0x08289c7b in main (argc=1, argv=0xbfee7bc4) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/main.cpp:303
^done(gdb) quitquit
The program is running.  Exit anyway? (y or n) [answered Y; input not from terminal]
(gdb) Process exited
gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Exited normally(gdb) quitgdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(gdb) bt
bt
#0  0xb5151ecb in std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::find () from /usr/lib/libexiv2.so.4
#1  0xb516c20a in VerifyXPathRoot () from /usr/lib/libexiv2.so.4
#2  0xb516d227 in ExpandXPath () from /usr/lib/libexiv2.so.4
#3  0xb515dfe4 in GetNextXMPNode () from /usr/lib/libexiv2.so.4
#4  0xb515e17a in XMPIterator::Next () from /usr/lib/libexiv2.so.4
#5  0xb517acb3 in WXMPIterator_Next_1 () from /usr/lib/libexiv2.so.4
#6  0xb5146a4e in TXMPIterator<std::string>::Next () from /usr/lib/libexiv2.so.4
#7  0xb5140883 in Exiv2::XmpParser::decode () from /usr/lib/libexiv2.so.4
#8  0xb50e41d8 in Exiv2::JpegBase::readMetadata () from /usr/lib/libexiv2.so.4
#9  0xb5c83e5e in KExiv2Iface::KExiv2::load (this=0xbf8dd3f4, filePath=@0xbf8dd3fc) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp:160
#10 0xb6acbbd0 in Digikam::DMetadata::load (this=0xbf8dd3f4, filePath=@0xbf8dd3fc) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:74
#11 0xb6acbd1a in DMetadata (this=0xbf8dd3f4, filePath=@0xbf8dd3fc) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:62
#12 0xb6be6b24 in Digikam::ImagePropertiesMetaDataTab::setCurrentURL (this=0x8bba040, url=@0x876e488) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiesmetadatatab.cpp:158
#13 0x080b56ea in Digikam::ImagePropertiesSideBarDB::slotChangedTab (this=0x876e458, tab=0x8bba040) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:261
#14 0x080b4e09 in Digikam::ImagePropertiesSideBarDB::itemChanged (this=0x876e458, infos=@0xbf8dd5a0, rect=@0xbf8dd590, img=0x0) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:175
#15 0x080b4ec5 in Digikam::ImagePropertiesSideBarDB::itemChanged (this=0x876e458, infos=@0xbf8dd5e8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:156
#16 0x08263b15 in Digikam::DigikamView::slotDispatchImageSelected (this=0x84dca08) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/digikamview.cpp:1099
#17 0x082648e8 in Digikam::DigikamView::qt_metacall (this=0x84dca08, _c=QMetaObject::InvokeMetaMethod, _id=76, _a=0xbf8dd6b0) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/digikamview.moc:297
#18 0xb7ee7447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#19 0xb7ee7fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#20 0xb7f02b05 in QTimer::timeout () from /usr/lib/qt4/lib/libQtCore.so.4
#21 0xb7eed760 in QTimer::timerEvent () from /usr/lib/qt4/lib/libQtCore.so.4
#22 0xb7ee42b5 in QObject::event () from /usr/lib/qt4/lib/libQtCore.so.4
#23 0xb6e6f1c2 in QApplicationPrivate::notify_helper () from /usr/lib/qt4/lib/libQtGui.so.4
#24 0xb6e75781 in QApplication::notify () from /usr/lib/qt4/lib/libQtGui.so.4
#25 0xb799a281 in KApplication::notify () from /opt/kde4/lib/libkdeui.so.5
#26 0xb7ed5378 in QCoreApplication::notifyInternal () from /usr/lib/qt4/lib/libQtCore.so.4
#27 0xb7ef868f in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#28 0xb7ef98b8 in QEventDispatcherUNIX::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#29 0xb6eeb9a3 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtGui.so.4
#30 0xb7ed47e3 in QEventLoop::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#31 0xb7ed48ea in QEventLoop::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#32 0xb7ed6c46 in QCoreApplication::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#33 0xb6e6e884 in QApplication::exec () from /usr/lib/qt4/lib/libQtGui.so.4
#34 0x08289c7b in main (argc=1, argv=0xbf8de5b4) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/main.cpp:303
^done

The line in kexiv2.cpp code is this one :

http://lxr.kde.org/source/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp#160

Gilles
Comment 27 Andreas Huggel 2008-07-30 12:36:37 UTC
Can you reproduce the crash with the exiv2 tool, just $ exiv2 <image> ? (this calls the same Image::readMetadata() function)

Comment 28 caulier.gilles 2008-07-30 12:58:21 UTC
>Can you reproduce the crash with the exiv2 tool, just $ exiv2 <image> ? (this >calls the same Image::readMetadata() function) 

No. All work fine here (tested with all JPEG files from Vista)

Gilles
Comment 29 Andreas Huggel 2008-07-30 13:19:34 UTC
Minor fix: The two new XMP namespaces need to be registered with XMP-SDK, since it doesn't know them yet. (All other namespaces previously in Exiv2 are "built-into" XMP-SDK)

See http://dev.robotbattle.com/cmtinfo_svn.php?r=10&v=1549

Actually the last bt looks really weird. Can you please just recompile everything...

Andreas
Comment 30 caulier.gilles 2008-07-30 13:29:35 UTC
Andreas,

about this one http://dev.robotbattle.com/cgi-bin/viewvc.cgi/exiv2/trunk/src/properties.cpp?r1=1548&r2=1549

Take a care, M$ namesapce url do not take "/" at end. All photo with M$ XMP data are like this. I don't know if this is very important.

Gilles
Comment 31 caulier.gilles 2008-07-30 13:46:56 UTC
Andreas,

All recompiled from scratch. Crash still here :

gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Exited normally(gdb) quitgdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Quit
(gdb) quitquit
The program is running.  Exit anyway? (y or n) [answered Y; input not from terminal]
(gdb) Process exited
gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(gdb) bt
bt
#0  0xb51abfe7 in std::_Rb_tree<std::string, std::pair<std::string const, Exiv2::XmpNsInfo>, std::_Select1st<std::pair<std::string const, Exiv2::XmpNsInfo> >, std::less<std::string>, std::allocator<std::pair<std::string const, Exiv2::XmpNsInfo> > >::_M_insert_unique () from /usr/lib/libexiv2.so.4
#1  0xb51a9275 in Exiv2::XmpProperties::registerNs () from /usr/lib/libexiv2.so.4
#2  0xb5cf774d in KExiv2Priv (this=0xb1bb7a20) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2private.cpp:43
#3  0xb5cf378b in KExiv2 (this=0xbfee602c) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp:39
#4  0xb6b3adc5 in DMetadata (this=0xbfee602c) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:55
#5  0xb6c28178 in Digikam::ExifWidget::loadFromURL (this=0xb198cc58, url=@0xbfee60f8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/widgets/metadata/exifwidget.cpp:113
#6  0xb6c55a55 in Digikam::ImagePropertiesMetaDataTab::setCurrentURL (this=0xb198afd0, url=@0xbfee60f8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiesmetadatatab.cpp:149
#7  0xb6c4a1dc in Digikam::ImagePropertiesSideBar::slotNoCurrentItem (this=0xb1956438) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebar.cpp:112
#8  0x080b5fa0 in Digikam::ImagePropertiesSideBarDB::slotNoCurrentItem (this=0xb1956438) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:180
#9  0x080b6c10 in Digikam::ImagePropertiesSideBarDB::qt_metacall (this=0xb1956438, _c=QMetaObject::InvokeMetaMethod, _id=13, _a=0xbfee61f0) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagepropertiessidebardb.moc:109
#10 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#11 0xb7f56fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#12 0xb6ca3e63 in Digikam::EditorWindow::signalNoCurrentItem (this=0xaad02588) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/editorwindow.moc:221
#13 0xb6ca3fae in Digikam::EditorWindow::slotLoadingStarted (this=0xaad02588) at /mnt/data/devel/SVN/trunk/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp:1244
#14 0xb6ca4779 in Digikam::EditorWindow::qt_metacall (this=0xaad02588, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0xbfee6bbc) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/editorwindow.moc:169
#15 0x080a6a2a in Digikam::ImageWindow::qt_metacall (this=0xaad02588, _c=QMetaObject::InvokeMetaMethod, _id=60, _a=0xbfee6bbc) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagewindow.moc:102
#16 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#17 0xb7f56fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#18 0xb6c88e1c in Digikam::Canvas::signalLoadingStarted (this=0xaad01e68, _t1=@0xbfee6c08) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/canvas.moc:251
#19 0xb6c89a38 in Digikam::Canvas::load (this=0xaad01e68, filename=@0xbfee6c08, IOFileSettings=0xb19b1078) at /mnt/data/devel/SVN/trunk/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp:252
#20 0x080a4ffa in Digikam::ImageWindow::slotLoadCurrent (this=0xaad02588) at /mnt/data/devel/SVN/trunk/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp:538
#21 0x080a6b74 in Digikam::ImageWindow::qt_metacall (this=0xaad02588, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0xbfee6cb0) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagewindow.moc:117
#22 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#23 0xb7f56fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#24 0xb7f5c1c5 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#25 0xb7f5c20c in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#26 0xb7f532b5 in QObject::event () from /usr/lib/qt4/lib/libQtCore.so.4
#27 0xb6ede1c2 in QApplicationPrivate::notify_helper () from /usr/lib/qt4/lib/libQtGui.so.4
#28 0xb6ee4781 in QApplication::notify () from /usr/lib/qt4/lib/libQtGui.so.4
#29 0xb7a09281 in KApplication::notify () from /opt/kde4/lib/libkdeui.so.5
#30 0xb7f44378 in QCoreApplication::notifyInternal () from /usr/lib/qt4/lib/libQtCore.so.4
#31 0xb7f6768f in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#32 0xb7f688b8 in QEventDispatcherUNIX::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#33 0xb6f5a9a3 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtGui.so.4
#34 0xb7f437e3 in QEventLoop::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#35 0xb7f438ea in QEventLoop::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#36 0xb7f45c46 in QCoreApplication::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#37 0xb6edd884 in QApplication::exec () from /usr/lib/qt4/lib/libQtGui.so.4
#38 0x08289c7b in main (argc=1, argv=0xbfee7bc4) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/main.cpp:303
^done(gdb) quitquit
The program is running.  Exit anyway? (y or n) [answered Y; input not from terminal]
(gdb) Process exited
gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Exited normally(gdb) quitgdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(gdb) bt
bt
#0  0xb5151ecb in std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::find () from /usr/lib/libexiv2.so.4
#1  0xb516c20a in VerifyXPathRoot () from /usr/lib/libexiv2.so.4
#2  0xb516d227 in ExpandXPath () from /usr/lib/libexiv2.so.4
#3  0xb515dfe4 in GetNextXMPNode () from /usr/lib/libexiv2.so.4
#4  0xb515e17a in XMPIterator::Next () from /usr/lib/libexiv2.so.4
#5  0xb517acb3 in WXMPIterator_Next_1 () from /usr/lib/libexiv2.so.4
#6  0xb5146a4e in TXMPIterator<std::string>::Next () from /usr/lib/libexiv2.so.4
#7  0xb5140883 in Exiv2::XmpParser::decode () from /usr/lib/libexiv2.so.4
#8  0xb50e41d8 in Exiv2::JpegBase::readMetadata () from /usr/lib/libexiv2.so.4
#9  0xb5c83e5e in KExiv2Iface::KExiv2::load (this=0xbf8dd3f4, filePath=@0xbf8dd3fc) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp:160
#10 0xb6acbbd0 in Digikam::DMetadata::load (this=0xbf8dd3f4, filePath=@0xbf8dd3fc) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:74
#11 0xb6acbd1a in DMetadata (this=0xbf8dd3f4, filePath=@0xbf8dd3fc) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:62
#12 0xb6be6b24 in Digikam::ImagePropertiesMetaDataTab::setCurrentURL (this=0x8bba040, url=@0x876e488) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiesmetadatatab.cpp:158
#13 0x080b56ea in Digikam::ImagePropertiesSideBarDB::slotChangedTab (this=0x876e458, tab=0x8bba040) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:261
#14 0x080b4e09 in Digikam::ImagePropertiesSideBarDB::itemChanged (this=0x876e458, infos=@0xbf8dd5a0, rect=@0xbf8dd590, img=0x0) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:175
#15 0x080b4ec5 in Digikam::ImagePropertiesSideBarDB::itemChanged (this=0x876e458, infos=@0xbf8dd5e8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:156
#16 0x08263b15 in Digikam::DigikamView::slotDispatchImageSelected (this=0x84dca08) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/digikamview.cpp:1099
#17 0x082648e8 in Digikam::DigikamView::qt_metacall (this=0x84dca08, _c=QMetaObject::InvokeMetaMethod, _id=76, _a=0xbf8dd6b0) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/digikamview.moc:297
#18 0xb7ee7447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#19 0xb7ee7fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#20 0xb7f02b05 in QTimer::timeout () from /usr/lib/qt4/lib/libQtCore.so.4
#21 0xb7eed760 in QTimer::timerEvent () from /usr/lib/qt4/lib/libQtCore.so.4
#22 0xb7ee42b5 in QObject::event () from /usr/lib/qt4/lib/libQtCore.so.4
#23 0xb6e6f1c2 in QApplicationPrivate::notify_helper () from /usr/lib/qt4/lib/libQtGui.so.4
#24 0xb6e75781 in QApplication::notify () from /usr/lib/qt4/lib/libQtGui.so.4
#25 0xb799a281 in KApplication::notify () from /opt/kde4/lib/libkdeui.so.5
#26 0xb7ed5378 in QCoreApplication::notifyInternal () from /usr/lib/qt4/lib/libQtCore.so.4
#27 0xb7ef868f in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#28 0xb7ef98b8 in QEventDispatcherUNIX::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#29 0xb6eeb9a3 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtGui.so.4
#30 0xb7ed47e3 in QEventLoop::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#31 0xb7ed48ea in QEventLoop::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#32 0xb7ed6c46 in QCoreApplication::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#33 0xb6e6e884 in QApplication::exec () from /usr/lib/qt4/lib/libQtGui.so.4
#34 0x08289c7b in main (argc=1, argv=0xbf8de5b4) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/main.cpp:303
^done(gdb) quitgdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(gdb) bt
bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb53515d5 in raise () from /lib/i686/libc.so.6
#2  0xb5353021 in abort () from /lib/i686/libc.so.6
#3  0xb538935c in QAbstractItemModel::sort () from /lib/i686/libc.so.6
#4  0x0000002e in ?? ()
#5  0xb5390ff3 in QAbstractItemModel::sort () from /lib/i686/libc.so.6
#6  0x00000002 in ?? ()
#7  0xbff306db in ?? ()
#8  0xb544fdf8 in QAbstractItemModel::sort () from /lib/i686/libc.so.6
#9  0xa95fc80b in ?? ()
#10 0xb5391301 in QAbstractItemModel::sort () from /lib/i686/libc.so.6
#11 0xa95fc80b in ?? ()
#12 0xaa3b3d90 in ?? ()
#13 0xb2d0001c in ?? ()
#14 0xaa3bb9a8 in ?? ()
#15 0xb544fdf8 in QAbstractItemModel::sort () from /lib/i686/libc.so.6
#16 0xb5390941 in QAbstractItemModel::sort () from /lib/i686/libc.so.6
#17 0xb538f31b in QAbstractItemModel::sort () from /lib/i686/libc.so.6
#18 0xb5467ff4 in ?? () from /lib/i686/libc.so.6
#19 0x00000000 in ?? ()
^done(gdb) quitquit
The program is running.  Exit anyway? (y or n) [answered Y; input not from terminal]
(gdb) Process exited
gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(gdb) bt
bt
#0  0xb51a0f0b in std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::find () from /usr/lib/libexiv2.so.4
#1  0xb519d45c in XMPMeta::RegisterNamespace () from /usr/lib/libexiv2.so.4
#2  0xb51bd6ec in StartNamespaceDeclHandler () from /usr/lib/libexiv2.so.4
#3  0xb4c5bfa9 in QAbstractItemModel::sort () from /usr/lib/libexpat.so.1
#4  0xb4c5f2f6 in QAbstractItemModel::sort () from /usr/lib/libexpat.so.1
#5  0xb4c5fef7 in QAbstractItemModel::sort () from /usr/lib/libexpat.so.1
#6  0xb4c60e6e in QAbstractItemModel::sort () from /usr/lib/libexpat.so.1
#7  0xb4c61a95 in QAbstractItemModel::sort () from /usr/lib/libexpat.so.1
#8  0xb4c62f60 in QAbstractItemModel::sort () from /usr/lib/libexpat.so.1
#9  0xb4c5a4c0 in XML_ParseBuffer () from /usr/lib/libexpat.so.1
#10 0xb4c634db in XML_Parse () from /usr/lib/libexpat.so.1
#11 0xb51bd769 in ExpatAdapter::ParseBuffer () from /usr/lib/libexiv2.so.4
#12 0xb51a60fa in ProcessUTF8Portion () from /usr/lib/libexiv2.so.4
#13 0xb51a7986 in XMPMeta::ParseFromBuffer () from /usr/lib/libexiv2.so.4
#14 0xb51c559a in WXMPMeta_ParseFromBuffer_1 () from /usr/lib/libexiv2.so.4
#15 0xb5196243 in TXMPMeta<std::string>::ParseFromBuffer () from /usr/lib/libexiv2.so.4
#16 0xb51962de in TXMPMeta<std::string>::TXMPMeta () from /usr/lib/libexiv2.so.4
#17 0xb518f816 in Exiv2::XmpParser::decode () from /usr/lib/libexiv2.so.4
#18 0xb51331d8 in Exiv2::JpegBase::readMetadata () from /usr/lib/libexiv2.so.4
#19 0xb5cd2e5e in KExiv2Iface::KExiv2::load (this=0xa98fc95c, filePath=@0xa2adea4) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp:160
#20 0xb6b1abd0 in Digikam::DMetadata::load (this=0xa98fc95c, filePath=@0xa2adea4) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:74
#21 0xb6af1ef5 in Digikam::DImgLoader::readMetadata (this=0xa98fcf5c, filePath=@0xa2adea4) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/loaders/dimgloader.cpp:150
#22 0xb6af6bed in Digikam::JPEGLoader::load (this=0xa98fcf5c, filePath=@0xa2adea4, observer=0xa2adea0) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/loaders/jpegloader.cpp:104
#23 0xb6ae0967 in Digikam::DImg::load (this=0xa98fd2b4, filePath=@0xa2adea4, loadFlagsInt=31, observer=0xa2adea0, rawDecodingSettings=@0xa98fd050) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/dimg.cpp:345
#24 0xb6ae16af in Digikam::DImg::load (this=0xa98fd2b4, filePath=@0xa2adea4, observer=0xa2adea0, rawDecodingSettings=@0xa98fd0d0) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/dimg.cpp:320
#25 0xb6ae1f4c in DImg (this=0xa98fd2b4, filePath=@0xa2adea4, observer=0xa2adea0, rawDecodingSettings=@0xa98fd2b8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/dimg.cpp:89
#26 0xb6b9aefa in Digikam::SharedLoadingTask::execute (this=0xa2ade98) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/threadimageio/loadsavetask.cpp:170
#27 0xb6b8eeca in Digikam::LoadSaveThread::run (this=0xa2c07b8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/threadimageio/loadsavethread.cpp:127
#28 0xb7e7aae9 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#29 0xb7e0d4e2 in start_thread () from /lib/i686/libpthread.so.0
#30 0xb54cc47e in clone () from /lib/i686/libc.so.6
^done

Gilles
Comment 32 Andreas Huggel 2008-07-30 14:14:32 UTC
Gilles,

How do I read this? 4 different crashes?

1) In a std:: function called from Exiv2::XmpProperties::registerNs () - why is there still a call to this function?
2) In an std:: function called from VerifyXPathRoot () - which is an XMP-SDK call, I believe - this is the weird one
3) Somewhere deep within QAbstractItemModel::sort () - definitely not my problem
4) In an std:: function called from XMPMeta::RegisterNamespace () [XMP-SDK], from:QAbstractItemModel::sort 
#2  0xb51bd6ec in StartNamespaceDeclHandler () from /usr/lib/libexiv2.so.4
#3  0xb4c5bfa9 in QAbstractItemModel::sort () from /usr/lib/libexpat.so.1 

But there is no StartNamespaceDeclHandler in libexiv2 and I'm pretty sure there
is also no  QAbstractItemModel::sort in libexpat

What's going on?

Do you call XmpParser::initialize() in digiKam's initialization section now to make sure it is only called exactly once, or is it still called from some class, maybe many times?
Comment 33 Andreas Huggel 2008-07-30 14:32:37 UTC
Re Comment #30: Thanks for highlighting this. I'm also not sure how important it is. The XMP-SDK doc says "The namespace URI should always end in an XML name separator such as '/' or '#'. This is because some forms of RDF shorthand catenate a namespace URI with an element name to form a new URI." 

Any idea if it matters for M$ applications?
Comment 34 caulier.gilles 2008-07-30 14:37:28 UTC
Andreas,

From comments #32:

It's sound like the backtrace is corrupted a little. I can use valgrind instead gdb but i'm pretty sure than the non-reentrency problem will diseapear because valgrind slowdown application.

From comments #33 : no idea.

Gilles
Comment 35 Andreas Huggel 2008-07-30 15:44:21 UTC
Gilles,

the important questions about this bt are
- why is there still a call to Exiv2::XmpProperties::registerNs()? I thought it's no longer needed as Exiv2 now knows the ns.
- Does digiKam call XmpParser::initialize() from its initialization section now? Assuming we really have a re-entrancy issue with this function, it must be called where it is guaranteed that only one thread calls it.

Andreas
Comment 36 caulier.gilles 2008-07-30 15:58:27 UTC
Andreas, 

>- why is there still a call to Exiv2::XmpProperties::registerNs()? I thought >it's no longer needed as Exiv2 now knows the ns.

In digiKam, thrue libkexiv2, digiKam register "digiKam" XMP namespace in case to use Exiv2 < 0.18. I have removed the registration now.

>- Does digiKam call XmpParser::initialize() from its initialization section now? >Assuming we really have a re-entrancy issue with this function, it must be called >where it is guaranteed that only one thread calls it. 

No. digiKam do not call direclty Exiv2 API. in libkexiv2, the only possible call is in private internal container, but this code is disable in my case.
Comment 37 caulier.gilles 2008-07-30 16:00:14 UTC
SVN commit 839657 by cgilles:

remove hardcoded digiKam XMP namespace registration. This one is now included into Exiv2 0.18
CCBUGS: 166424


 M  +0 -10     dmetadata.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=839657
Comment 38 caulier.gilles 2008-07-30 16:02:12 UTC
SVN commit 839658 by cgilles:

Do not register M$ XMP namespace and do not initialize XMP parser (code is non-reentrant from Adibe XMP SDK 
CCBUGS: 166424


 M  +0 -14     kexiv2private.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=839658
Comment 39 caulier.gilles 2008-07-30 16:11:28 UTC
Andreas,

I have cleaned libkexiv2 source code and digiKam DMetadata code about no re-entrancy Exiv2 calls. Crash still here at the same place into libkexiv2:

gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Exited normally(gdb) quitgdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Quit
(gdb) quitquit
The program is running.  Exit anyway? (y or n) [answered Y; input not from terminal]
(gdb) Process exited
gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Exited normally(gdb) bt
bt
#0  0xb50d2f0b in std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::find () from /usr/lib/libexiv2.so.4
#1  0xb50ced60 in XMPMeta::GetNamespacePrefix () from /usr/lib/libexiv2.so.4
#2  0xb50eb8c5 in FindSchemaNode () from /usr/lib/libexiv2.so.4
#3  0xb50f18d2 in AddChildNode () from /usr/lib/libexiv2.so.4
#4  0xb50f2308 in RDF_PropertyElementList () from /usr/lib/libexiv2.so.4
#5  0xb50f2b17 in RDF_NodeElement () from /usr/lib/libexiv2.so.4
#6  0xb50f2cbd in ProcessRDF () from /usr/lib/libexiv2.so.4
#7  0xb50d9bfa in XMPMeta::ParseFromBuffer () from /usr/lib/libexiv2.so.4
#8  0xb50f759a in WXMPMeta_ParseFromBuffer_1 () from /usr/lib/libexiv2.so.4
#9  0xb50c8243 in TXMPMeta<std::string>::ParseFromBuffer () from /usr/lib/libexiv2.so.4
#10 0xb50c82de in TXMPMeta<std::string>::TXMPMeta () from /usr/lib/libexiv2.so.4
#11 0xb50c1816 in Exiv2::XmpParser::decode () from /usr/lib/libexiv2.so.4
#12 0xb50651d8 in Exiv2::JpegBase::readMetadata () from /usr/lib/libexiv2.so.4
#13 0xb5c04e64 in KExiv2Iface::KExiv2::load (this=0xaacfe95c, filePath=@0xd3d7464) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp:185
#14 0xb6a4ca5a in Digikam::DMetadata::load (this=0xaacfe95c, filePath=@0xd3d7464) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:74
#15 0xb6a23ed5 in Digikam::DImgLoader::readMetadata (this=0xaacfef5c, filePath=@0xd3d7464) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/loaders/dimgloader.cpp:150
#16 0xb6a28bcd in Digikam::JPEGLoader::load (this=0xaacfef5c, filePath=@0xd3d7464, observer=0xd3d7460) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/loaders/jpegloader.cpp:104
#17 0xb6a12947 in Digikam::DImg::load (this=0xaacff2b4, filePath=@0xd3d7464, loadFlagsInt=31, observer=0xd3d7460, rawDecodingSettings=@0xaacff050) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/dimg.cpp:345
#18 0xb6a1368f in Digikam::DImg::load (this=0xaacff2b4, filePath=@0xd3d7464, observer=0xd3d7460, rawDecodingSettings=@0xaacff0d0) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/dimg.cpp:320
#19 0xb6a13f2c in DImg (this=0xaacff2b4, filePath=@0xd3d7464, observer=0xd3d7460, rawDecodingSettings=@0xaacff2b8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dimg/dimg.cpp:89
#20 0xb6accd82 in Digikam::SharedLoadingTask::execute (this=0xd3d7458) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/threadimageio/loadsavetask.cpp:170
#21 0xb6ac0d52 in Digikam::LoadSaveThread::run (this=0xa2f06d8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/threadimageio/loadsavethread.cpp:127
#22 0xb7dacae9 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#23 0xb7d3f4e2 in start_thread () from /lib/i686/libpthread.so.0
#24 0xb53fe47e in clone () from /lib/i686/libc.so.6
^done

Gilles
Comment 40 Andreas Huggel 2008-07-30 16:20:05 UTC
Gilles,

if there is no explicit call to Exiv2::XmpParser::initialize() then it will be called the first time the XmpParser is used. And that is potentially by multiple threads at the same time.

Suggestion:
- Introduce a initialize() function in libkexiv2, just a wrapper to  Exiv2::XmpParser::initialize()
- Call it from digikam's initialization section

Andreas
Comment 41 caulier.gilles 2008-07-30 16:31:27 UTC
SVN commit 839676 by cgilles:

add new method initializeExiv2() to set on Adobe XMP SDK from Exiv2
CCBUGS: 166424


 M  +9 -0      kexiv2.cpp  
 M  +7 -0      kexiv2.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=839676
Comment 42 caulier.gilles 2008-07-30 16:49:04 UTC
Andreas,

With commit #839677 digiKam and Showfoto now initialize Adobe XMP SDK at startup.

Damned, now digiKAm crash very quickly when an image is open in editor:

gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Exited normally(gdb) quitgdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
Quit
(gdb) quitquit
The program is running.  Exit anyway? (y or n) [answered Y; input not from terminal]
(gdb) Process exited
gdb /opt/kde4/bin/digikam --interpreter=mi2 -quiet
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(gdb) bt
bt
#0  0xb51abfe7 in std::_Rb_tree<std::string, std::pair<std::string const, Exiv2::XmpNsInfo>, std::_Select1st<std::pair<std::string const, Exiv2::XmpNsInfo> >, std::less<std::string>, std::allocator<std::pair<std::string const, Exiv2::XmpNsInfo> > >::_M_insert_unique () from /usr/lib/libexiv2.so.4
#1  0xb51a9275 in Exiv2::XmpProperties::registerNs () from /usr/lib/libexiv2.so.4
#2  0xb5cf774d in KExiv2Priv (this=0xb1bb7a20) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2private.cpp:43
#3  0xb5cf378b in KExiv2 (this=0xbfee602c) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2.cpp:39
#4  0xb6b3adc5 in DMetadata (this=0xbfee602c) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/dmetadata/dmetadata.cpp:55
#5  0xb6c28178 in Digikam::ExifWidget::loadFromURL (this=0xb198cc58, url=@0xbfee60f8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/widgets/metadata/exifwidget.cpp:113
#6  0xb6c55a55 in Digikam::ImagePropertiesMetaDataTab::setCurrentURL (this=0xb198afd0, url=@0xbfee60f8) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiesmetadatatab.cpp:149
#7  0xb6c4a1dc in Digikam::ImagePropertiesSideBar::slotNoCurrentItem (this=0xb1956438) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebar.cpp:112
#8  0x080b5fa0 in Digikam::ImagePropertiesSideBarDB::slotNoCurrentItem (this=0xb1956438) at /mnt/data/devel/SVN/trunk/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp:180
#9  0x080b6c10 in Digikam::ImagePropertiesSideBarDB::qt_metacall (this=0xb1956438, _c=QMetaObject::InvokeMetaMethod, _id=13, _a=0xbfee61f0) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagepropertiessidebardb.moc:109
#10 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#11 0xb7f56fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#12 0xb6ca3e63 in Digikam::EditorWindow::signalNoCurrentItem (this=0xaad02588) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/editorwindow.moc:221
#13 0xb6ca3fae in Digikam::EditorWindow::slotLoadingStarted (this=0xaad02588) at /mnt/data/devel/SVN/trunk/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp:1244
#14 0xb6ca4779 in Digikam::EditorWindow::qt_metacall (this=0xaad02588, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0xbfee6bbc) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/editorwindow.moc:169
#15 0x080a6a2a in Digikam::ImageWindow::qt_metacall (this=0xaad02588, _c=QMetaObject::InvokeMetaMethod, _id=60, _a=0xbfee6bbc) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagewindow.moc:102
#16 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#17 0xb7f56fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#18 0xb6c88e1c in Digikam::Canvas::signalLoadingStarted (this=0xaad01e68, _t1=@0xbfee6c08) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/canvas.moc:251
#19 0xb6c89a38 in Digikam::Canvas::load (this=0xaad01e68, filename=@0xbfee6c08, IOFileSettings=0xb19b1078) at /mnt/data/devel/SVN/trunk/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp:252
#20 0x080a4ffa in Digikam::ImageWindow::slotLoadCurrent (this=0xaad02588) at /mnt/data/devel/SVN/trunk/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp:538
#21 0x080a6b74 in Digikam::ImageWindow::qt_metacall (this=0xaad02588, _c=QMetaObject::InvokeMetaMethod, _id=10, _a=0xbfee6cb0) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/imagewindow.moc:117
#22 0xb7f56447 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#23 0xb7f56fb5 in QMetaObject::activate () from /usr/lib/qt4/lib/libQtCore.so.4
#24 0xb7f5c1c5 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#25 0xb7f5c20c in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#26 0xb7f532b5 in QObject::event () from /usr/lib/qt4/lib/libQtCore.so.4
#27 0xb6ede1c2 in QApplicationPrivate::notify_helper () from /usr/lib/qt4/lib/libQtGui.so.4
#28 0xb6ee4781 in QApplication::notify () from /usr/lib/qt4/lib/libQtGui.so.4
#29 0xb7a09281 in KApplication::notify () from /opt/kde4/lib/libkdeui.so.5
#30 0xb7f44378 in QCoreApplication::notifyInternal () from /usr/lib/qt4/lib/libQtCore.so.4
#31 0xb7f6768f in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtCore.so.4
#32 0xb7f688b8 in QEventDispatcherUNIX::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#33 0xb6f5a9a3 in QAbstractItemModel::sort () from /usr/lib/qt4/lib/libQtGui.so.4
#34 0xb7f437e3 in QEventLoop::processEvents () from /usr/lib/qt4/lib/libQtCore.so.4
#35 0xb7f438ea in QEventLoop::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#36 0xb7f45c46 in QCoreApplication::exec () from /usr/lib/qt4/lib/libQtCore.so.4
#37 0xb6edd884 in QApplication::exec () from /usr/lib/qt4/lib/libQtGui.so.4
#38 0x08289c7b in main (argc=1, argv=0xbfee7bc4) at /mnt/data/devel/SVN/trunk/graphics/digikam/digikam/main.cpp:303
^done(gdb) quitquit
The program is running.  Exit anyway? (y or n) [answered Y; input not from terminal]

This is the code relevant from KEXiv2 private class destructor :

    // Fix memory leak if Exiv2 support XMP.
#ifdef _XMP_SUPPORT_
    Exiv2::XmpParser::terminate();
#endif // _XMP_SUPPORT_

Do you remember ? It's to fix memory leak from XMP SDK when KExiv2 instance is closed.

So i suppose than this call must be removed here and called in a wrapper method to cleanup memory at the right place in digiKam destructor

Gilles
Comment 43 caulier.gilles 2008-07-30 16:58:42 UTC
Andreas,

Yes, removing this code fix the problem. I will add a new static method to cleanup Exiv2 outside multithreading stuff...

Question : What's happen if 2 instance of digiKam are started at the same time ? Crash will back ?

Best

Gilles

Comment 44 caulier.gilles 2008-07-30 17:02:34 UTC
SVN commit 839685 by cgilles:

new method to clean up Adobe XMP sdk memory allocation outside multi-threading
CCBUGS: 166424


 M  +10 -0     kexiv2.cpp  
 M  +7 -0      kexiv2.h  
 M  +0 -4      kexiv2private.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=839685
Comment 45 caulier.gilles 2008-07-30 17:03:36 UTC
SVN commit 839686 by cgilles:

cleanup Exiv2 at end of digiKam or Showfoto instance
CCBUGS: 166424


 M  +4 -0      digikam/main.cpp  
 M  +4 -0      showfoto/main.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=839686
Comment 46 caulier.gilles 2008-07-30 17:06:13 UTC
Marcel,

What happen about digiKam KIO-slave which run outside digiKam instance and which use KExiv2 ? We need to patch in the same way ?

Gilles
Comment 47 Andreas Huggel 2008-07-30 17:12:37 UTC
Re Comment #42: Yes, the call to terminate may also need to be moved, if it's called more than once.

But XmpProperties::registerNs is STILL called from libkexiv2... 

#1  0xb51a9275 in Exiv2::XmpProperties::registerNs () from /usr/lib/libexiv2.so.4
#2  0xb5cf774d in KExiv2Priv (this=0xb1bb7a20) at /home/gilles/Documents/data/devel/SVN/trunk/KDE/kdegraphics/libs/libkexiv2/libkexiv2/kexiv2private.cpp:43 

Re Comment #43:

> Yes, removing this code fix the problem. 
Great!

> Question : What's happen if 2 instance of digiKam are started at the same time ? Crash will back ? 

Shouldn't be a problem. This memory is not shared, each digiKam process has its own.

Andreas
Comment 48 caulier.gilles 2008-07-30 18:17:52 UTC
Geoff, Dotan,

Please, please please, test on your computer. This entry is very important to stabilize the code. I would to solve it definitivly before to release 0.10.0-beta2. This is the way to test :

1/ checkout and recompile : Exiv2 from trunk, libkexiv2 from trunk, digikam and kipi-plugins from trunk.
2/ start digiKam. From Album gui, open histogram tab from right sidebar (for force digiKam to use multithreading at this place)
3/ Go to an album with JPEG images including XMP metadata (you can use my images here: http://digikam3rdparty.free.fr/TEST_IMAGES/METADATA/Vista)
4/ open the first image from the album into editor. open the Metadata XMP tab from right sidebar.
5/ Show editor thumbbar
6/ Stress digiKam to select very quickly new items from thumbbar. digiKam must not crash.

Thanks in advance for your help...

Gilles Caulier
Comment 49 caulier.gilles 2008-07-30 18:33:28 UTC
Andreas, Dotan, Geoff,

Here i have tested the new code on 2 different computers, and crash are unreproductible...

Gilles
Comment 50 caulier.gilles 2008-07-31 08:03:53 UTC
Dotan, Geoff,

I have tested on a 3rd computer. all work fine. 

I close this file as FIXED. Don't hesitate to re-open it if necessary.

Gilles Caulier
Comment 51 Marcel Wiesweg 2008-08-01 11:02:19 UTC
To #46:
The kioslaves dont use multithreading as far as I see, so there shouldn't be a problem.
If you want to add initialization anyway, it must be done in the kdemain() method that you find at the bottom of the ioslave cpp files.
Comment 52 caulier.gilles 2008-08-01 11:07:22 UTC
Thanks for the tip Marcel.

For the moment, i will not add something in KIOslave. We will wait and see if this require something like that later (duing a side effect)... 

...excepted if Andreas think that it's better to always initialize XMP SDK toolkit in all case...

Andreas ?

Gilles
Comment 53 Geoff King 2008-08-07 02:45:15 UTC
I tried the stress test and had no crashes.  Works for me. 
Comment 54 caulier.gilles 2021-05-04 10:16:48 UTC
Not reproducible with digiKam 7.3.0 and Exiv2 0.27.4