[Digikam-devel] Several crashes of digikam

Caulier Gilles caulier.gilles at kdemail.net
Sun May 21 16:08:39 BST 2006


Le Dimanche 21 Mai 2006 04:20 PM, Marcel Wiesweg a écrit :
> Am Sonntag 21 Mai 2006 14:05 schrieb Heiner Lamprecht:
> > Hi everybody,
> >
> > at the moment, digikam is very unstable on my machine.  I made an
> > svn update this morning and compiled all the stuff.  While playing
> > a little bit with the app, I had three crashes.
> >
> > 1. When opening an image in IE (see digikam_crash_1.log)
>
> This log differs from the others in that it does not provide debug options.
> But anyway, I dont know what might cause this.
>
> > 2. During start of the application (see digikam_crash_2.log)
>
> This crash comes from libexiv2.

yes. I'm currently in discussion with Exiv2 author about this subject, because 
i can reproduce this crash since 1 week on 1 computer in my office using 
Mandriva 2005, but never on all others computer using Mandriva 2006 !!! I 
don"t know why...

Like suggested Exiv2 author, there is a problem in dmetaloader.cpp lines 87, 
94 and 101 : reference = reference !!! Look the message from Andreas below :

// ------------------------------------------------------------------------
...
I suspect the problem is here:

bool DMetaLoader::loadWithExiv2(const QString& filePath)
{
    try
    {    
        if (filePath.isEmpty())
            return false;

        Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open((const char*)
                                      (QFile::encodeName(filePath)));
        image->readMetadata();

        // Image comments ---------------------------------

[snip]

        // Exif metadata ----------------------------------
        
        exifMetadata() = image->exifData();

Both, exifMetadata() and image->exifData() return a reference only, the 
metadata is not copied, it is still in the container owned by the image.

        if (!exifMetadata().empty())
            m_hasExif = true;

[snip]

        return true;
    }

The Image::AutoPtr goes out of scope and the image is deleted. All references 
to the metadata inside the image become invalid and future access through 
such references have undefined behaviour.

Could that be it?
...
// ------------------------------------------------------------------------

It's easy to fix it, and this is must be done in all cases. Marcel, if you 
have some time to do it, feel free to do, i'm busy today.

Gilles



More information about the Digikam-devel mailing list