]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/module.c
The 8bim profile will be updated when the iptc profile is changed.
[imagemagick] / MagickCore / module.c
index 4051ddd77da7d48a2de32ee1244c5f24170db57e..94acdd43aae34674712bedf4100569de8803d350 100644 (file)
@@ -853,30 +853,36 @@ static void *DestroyModuleNode(void *module_info)
 static MagickBooleanType IsModuleTreeInstantiated(
   ExceptionInfo *magick_unused(exception))
 {
-  if (module_semaphore == (SemaphoreInfo *) NULL)
-    ActivateSemaphoreInfo(&module_semaphore);
-  LockSemaphoreInfo(module_semaphore);
   if (module_list == (SplayTreeInfo *) NULL)
     {
-      MagickBooleanType
-        status;
-
-      ModuleInfo
-        *module_info;
-
-      module_list=NewSplayTree(CompareSplayTreeString,
-        (void *(*)(void *)) NULL,DestroyModuleNode);
+      if (module_semaphore == (SemaphoreInfo *) NULL)
+        ActivateSemaphoreInfo(&module_semaphore);
+      LockSemaphoreInfo(module_semaphore);
       if (module_list == (SplayTreeInfo *) NULL)
-        ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
-      module_info=AcquireModuleInfo((const char *) NULL,"[boot-strap]");
-      module_info->stealth=MagickTrue;
-      status=AddValueToSplayTree(module_list,module_info->tag,module_info);
-      if (status == MagickFalse)
-        ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
-      if (lt_dlinit() != 0)
-        ThrowFatalException(ModuleFatalError,"UnableToInitializeModuleLoader");
+        {
+          MagickBooleanType
+            status;
+
+          ModuleInfo
+            *module_info;
+
+          module_list=NewSplayTree(CompareSplayTreeString,
+            (void *(*)(void *)) NULL,DestroyModuleNode);
+          if (module_list == (SplayTreeInfo *) NULL)
+            ThrowFatalException(ResourceLimitFatalError,
+              "MemoryAllocationFailed");
+          module_info=AcquireModuleInfo((const char *) NULL,"[boot-strap]");
+          module_info->stealth=MagickTrue;
+          status=AddValueToSplayTree(module_list,module_info->tag,module_info);
+          if (status == MagickFalse)
+            ThrowFatalException(ResourceLimitFatalError,
+              "MemoryAllocationFailed");
+          if (lt_dlinit() != 0)
+            ThrowFatalException(ModuleFatalError,
+              "UnableToInitializeModuleLoader");
+        }
+      UnlockSemaphoreInfo(module_semaphore);
     }
-  UnlockSemaphoreInfo(module_semaphore);
   return(module_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
 }
 \f
@@ -1143,7 +1149,8 @@ MagickPrivate MagickBooleanType ModuleComponentGenesis(void)
   MagickBooleanType
     status;
 
-  module_semaphore=AcquireSemaphoreInfo();
+  if (module_semaphore == (SemaphoreInfo *) NULL)
+    module_semaphore=AcquireSemaphoreInfo();
   exception=AcquireExceptionInfo();
   status=IsModuleTreeInstantiated(exception);
   exception=DestroyExceptionInfo(exception);