[Digikam-devel] Re: [libkexiv2] libkexiv2: Somehow clicking on the XMP tab in the metadata setup page or in the

Marcel Wiesweg marcel.wiesweg at gmx.de
Wed Mar 9 18:26:51 GMT 2011


> Somehow clicking on the XMP tab in the metadata setup page or in the
> advancedrename tool crashes when digiKam is listing some of my albums.

Side effect of memory access? A crash that only crashes under unfavorable 
circumstances.

> I
> don't understand why the setup page has anything to do with the currently
> opened album, but anyway:
> The iterator here sometimes points on a nullpointer, checking (*it) for
> NULL seems to fix the crash.
> 
> Anyone has a problem with the patch? Maybe I don't understand the code that
> well but at least for me it still works fine.

According to API docs, propertyList may return null in some cases. So your 
check is valid.
Btw: QString((*it)->name_).isNull()  ??
Why not just check if (*it)->name is null?

> 
> Andi
> 
> CCMAIL:digikam-devel at kde.org
> 
> M  +1    -2    libkexiv2/kexiv2_p.cpp
> 
> http://commits.kde.org/libkexiv2/fa43dbb1272f5523649f251dad7579a5fb836571
> 
> diff --git a/libkexiv2/kexiv2_p.cpp b/libkexiv2/kexiv2_p.cpp
> index 6acb064..e135e36 100644
> --- a/libkexiv2/kexiv2_p.cpp
> +++ b/libkexiv2/kexiv2_p.cpp
> @@ -399,7 +399,7 @@ int KExiv2::KExiv2Priv::getXMPTagsListFromPrefix(const
> QString& pf, KExiv2::Tags
> 
>      for (QList<const Exiv2::XmpPropertyInfo*>::iterator it = tags.begin();
> it != tags.end(); ++it) {
> -        do
> +        while ( (*it) && !QString((*it)->name_).isNull() )
>          {
>              QString     key = QLatin1String( Exiv2::XmpKey(
> pf.toAscii().data(), (*it)->name_ ).key().c_str() ); QStringList values;
> @@ -408,7 +408,6 @@ int KExiv2::KExiv2Priv::getXMPTagsListFromPrefix(const
> QString& pf, KExiv2::Tags ++(*it);
>              i++;
>          }
> -        while( !QString((*it)->name_).isNull() );
>      }
>      return i;
>  }




More information about the Digikam-devel mailing list