[libkexiv2] libkexiv2: Somehow clicking on the XMP tab in the metadata setup page or in the

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[libkexiv2] libkexiv2: Somehow clicking on the XMP tab in the metadata setup page or in the

Bugzilla from andi.clemens@gmx.net
Git commit fa43dbb1272f5523649f251dad7579a5fb836571 by Andi Clemens.
Committed on 09/03/2011 at 14:18.
Pushed by aclemens into branch 'master'.

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. 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.

Andi

CCMAIL:[hidden email]

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;
 }
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

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

Marcel Wiesweg

> 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:[hidden email]
>
> 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;
>  }

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel