]> granicus.if.org Git - imagemagick/commitdiff
Fixed order of nested exceptions.
authordirk <dirk@git.imagemagick.org>
Sun, 4 May 2014 20:46:11 +0000 (20:46 +0000)
committerdirk <dirk@git.imagemagick.org>
Sun, 4 May 2014 20:46:11 +0000 (20:46 +0000)
Magick++/lib/Exception.cpp
Magick++/lib/Magick++/Include.h

index acebe2819d4dc7b7e78ca095a3da6714362a298c..a6cd8c65048479304698f54d5d5ebe21a24221ec 100644 (file)
@@ -833,6 +833,9 @@ MagickPPExport void Magick::throwException(ExceptionInfo &exception_)
   MagickBooleanType
     relinquish;
 
+  size_t
+    index;
+
   // Just return if there is no reported error
   if (exception_.severity == UndefinedException)
     return;
@@ -842,11 +845,12 @@ MagickPPExport void Magick::throwException(ExceptionInfo &exception_)
   LockSemaphoreInfo(exception_.semaphore);
   if (exception_.exceptions != (void *) NULL)
     {
-      ResetLinkedListIterator((LinkedListInfo *) exception_.exceptions);
-      p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *)
+      index=GetNumberOfElementsInLinkedList((LinkedListInfo *)
         exception_.exceptions);
-      while (p != (const ExceptionInfo *) NULL)
+      while(index > 0)
       {
+        p=(const ExceptionInfo *) GetValueFromLinkedList((LinkedListInfo *)
+          exception_.exceptions,--index);
         if ((p->severity != exception_.severity) || (LocaleCompare(p->reason,
             exception_.reason) != 0) || (LocaleCompare(p->description,
             exception_.description) != 0))
@@ -860,8 +864,6 @@ MagickPPExport void Magick::throwException(ExceptionInfo &exception_)
                 nestedException=q;
               }
           }
-        p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *)
-          exception_.exceptions);
       }
     }
   UnlockSemaphoreInfo(exception_.semaphore);
index 12e1f0e5a68361d4c35990fda723bd1e33ee87e3..d9bc27e629d0264ac2e98b3fad4bdcc8db7fdd8d 100644 (file)
@@ -1235,6 +1235,7 @@ namespace Magick
   using MagickCore::GetMagickInfo;
   using MagickCore::GetMultilineTypeMetrics;
   using MagickCore::GetNextValueInLinkedList;
+  using MagickCore::GetNumberOfElementsInLinkedList;
   using MagickCore::GetPixelBlue;
   using MagickCore::GetPixelGreen;
   using MagickCore::GetPixelInfo;
@@ -1245,6 +1246,7 @@ namespace Magick
   using MagickCore::GetStringInfoDatum;
   using MagickCore::GetStringInfoLength;
   using MagickCore::GetTypeMetrics;
+  using MagickCore::GetValueFromLinkedList;
   using MagickCore::GetVirtualMetacontent;
   using MagickCore::GetVirtualPixels;
   using MagickCore::GetImageVirtualPixelMethod;