% MagickCore Exception Methods %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1993 %
% %
% %
-% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
GetExceptionInfo(clone_exception);
InheritException(clone_exception,exception);
- exception->relinquish=MagickTrue;
- return(exception);
+ clone_exception->relinquish=MagickTrue;
+ return(clone_exception);
}
\f
/*
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
if (exception->semaphore == (SemaphoreInfo *) NULL)
- AcquireSemaphoreInfo(&exception->semaphore);
+ ActivateSemaphoreInfo(&exception->semaphore);
LockSemaphoreInfo(exception->semaphore);
exception->severity=UndefinedException;
if (exception->exceptions != (void *) NULL)
if (exception->relinquish != MagickFalse)
exception->signature=(~MagickSignature);
UnlockSemaphoreInfo(exception->semaphore);
- DestroySemaphoreInfo(&exception->semaphore);
+ RelinquishSemaphoreInfo(&exception->semaphore);
if (relinquish != MagickFalse)
exception=(ExceptionInfo *) RelinquishMagickMemory(exception);
return(exception);
(void) ResetMagickMemory(exception,0,sizeof(*exception));
exception->severity=UndefinedException;
exception->exceptions=(void *) NewLinkedList(0);
- exception->semaphore=AllocateSemaphoreInfo();
+ exception->semaphore=AcquireSemaphoreInfo();
exception->signature=MagickSignature;
}
\f
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);
p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *)
relative->exceptions);
}
- UnlockSemaphoreInfo(exception->semaphore);
+ UnlockSemaphoreInfo(relative->semaphore);
}
\f
/*
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)
p->description=ConstantString(description);
p->signature=MagickSignature;
(void) AppendValueToLinkedList((LinkedListInfo *) exception->exceptions,p);
- exception->severity=p->severity;
- exception->reason=p->reason;
- exception->description=p->description;
+ if (p->severity >= exception->severity)
+ {
+ exception->severity=p->severity;
+ exception->reason=p->reason;
+ exception->description=p->description;
+ }
+ UnlockSemaphoreInfo(exception->semaphore);
return(MagickTrue);
}
\f
%
*/
-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],