]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 19 Feb 2013 12:42:11 +0000 (12:42 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 19 Feb 2013 12:42:11 +0000 (12:42 +0000)
MagickCore/exception.c

index fb50942f369a80542e0cbfa711d69035479a8c22..34a01f72c2e8d13bd2f90d4213763e77180433f3 100644 (file)
@@ -659,7 +659,7 @@ MagickExport void InheritException(ExceptionInfo *exception,
   assert(relative->signature == MagickSignature);
   if (relative->exceptions == (void *) NULL)
     return;
-  LockSemaphoreInfo(exception->semaphore);
+  LockSemaphoreInfo(relative->semaphore);
   ResetLinkedListIterator((LinkedListInfo *) relative->exceptions);
   p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *)
     relative->exceptions);
@@ -669,7 +669,7 @@ MagickExport void InheritException(ExceptionInfo *exception,
     p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *)
       relative->exceptions);
   }
-  UnlockSemaphoreInfo(exception->semaphore);
+  UnlockSemaphoreInfo(relative->semaphore);
 }
 \f
 /*
@@ -915,15 +915,22 @@ MagickExport MagickBooleanType ThrowException(ExceptionInfo *exception,
 
   assert(exception != (ExceptionInfo *) NULL);
   assert(exception->signature == MagickSignature);
+  LockSemaphoreInfo(exception->semaphore);
   p=(ExceptionInfo *) GetLastValueInLinkedList((LinkedListInfo *)
     exception->exceptions);
   if ((p != (ExceptionInfo *) NULL) && (p->severity == severity) &&
       (LocaleCompare(exception->reason,reason) == 0) &&
       (LocaleCompare(exception->description,description) == 0))
-    return(MagickTrue);
+    {
+      UnlockSemaphoreInfo(exception->semaphore);
+      return(MagickTrue);
+    }
   p=(ExceptionInfo *) AcquireMagickMemory(sizeof(*p));
   if (p == (ExceptionInfo *) NULL)
-    ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
+    {
+      UnlockSemaphoreInfo(exception->semaphore);
+      ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
+    }
   (void) ResetMagickMemory(p,0,sizeof(*p));
   p->severity=severity;
   if (reason != (const char *) NULL)
@@ -935,6 +942,7 @@ MagickExport MagickBooleanType ThrowException(ExceptionInfo *exception,
   exception->severity=p->severity;
   exception->reason=p->reason;
   exception->description=p->description;
+  UnlockSemaphoreInfo(exception->semaphore);
   return(MagickTrue);
 }
 \f
@@ -977,10 +985,10 @@ MagickExport MagickBooleanType ThrowException(ExceptionInfo *exception,
 %
 */
 
-MagickExport MagickBooleanType ThrowMagickExceptionList(ExceptionInfo *exception,
-  const char *module,const char *function,const size_t line,
-  const ExceptionType severity,const char *tag,const char *format,
-  va_list operands)
+MagickExport MagickBooleanType ThrowMagickExceptionList(
+  ExceptionInfo *exception,const char *module,const char *function,
+  const size_t line,const ExceptionType severity,const char *tag,
+  const char *format,va_list operands)
 {
   char
     message[MaxTextExtent],