]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 10 Sep 2009 14:53:56 +0000 (14:53 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 10 Sep 2009 14:53:56 +0000 (14:53 +0000)
magick/cache-private.h
magick/cache.c

index 37866dcbf53910cf8d6b91882559c6eb975c9c01..2d1e0df9b4beb11fe5ab91247c99a0965b40bf3c 100644 (file)
@@ -121,6 +121,9 @@ typedef struct _CacheInfo
   CacheType
     type;
 
+  MapMode
+    mode;
+
   MagickBooleanType
     mapped;
 
index 80b746622662a253177a7af20b393d6a55fb7484..2794b159b8c03a74b0b62662f628e8276d5be506 100644 (file)
@@ -184,6 +184,7 @@ MagickExport Cache AcquirePixelCache(const unsigned long number_threads)
     ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
   (void) ResetMagickMemory(cache_info,0,sizeof(*cache_info));
   cache_info->type=UndefinedCache;
+  cache_info->mode=IOMode;
   cache_info->colorspace=RGBColorspace;
   cache_info->file=(-1);
   cache_info->id=GetMagickThreadId();
@@ -3910,6 +3911,7 @@ static MagickBooleanType OpenPixelCache(Image *image,const MapMode mode,
   source_info.file=(-1);
   (void) FormatMagickString(cache_info->filename,MaxTextExtent,"%s[%ld]",
     image->filename,GetImageIndexInList(image));
+  cache_info->mode=mode;
   cache_info->rows=image->rows;
   cache_info->columns=image->columns;
   cache_info->active_index_channel=((image->storage_class == PseudoClass) ||
@@ -4169,13 +4171,13 @@ MagickExport MagickBooleanType PersistPixelCache(Image *image,
             {
               (void) CopyMagickString(cache_info->cache_filename,filename,
                 MaxTextExtent);
-              cache_info=(CacheInfo *) ReferencePixelCache(cache_info);
               *offset+=cache_info->length+pagesize-(cache_info->length %
                 pagesize);
+              (void) UnlockSemaphoreInfo(cache_info->semaphore);
+              cache_info=(CacheInfo *) ReferencePixelCache(cache_info);
               if (image->debug != MagickFalse)
                 (void) LogMagickEvent(CacheEvent,GetMagickModule(),
                   "Usurp resident persistent cache");
-              (void) UnlockSemaphoreInfo(cache_info->semaphore);
               return(MagickTrue);
             }
         }