summaryrefslogtreecommitdiff
path: root/dmagick/Array.d
diff options
context:
space:
mode:
Diffstat (limited to 'dmagick/Array.d')
-rw-r--r--dmagick/Array.d14
1 files changed, 4 insertions, 10 deletions
diff --git a/dmagick/Array.d b/dmagick/Array.d
index 339de5c..7778af7 100644
--- a/dmagick/Array.d
+++ b/dmagick/Array.d
@@ -595,26 +595,20 @@ void[] toBlob(Image[] images, string magick = null, size_t depth = 0, bool adjoi
{
size_t length;
- AcquireMemoryHandler oldMalloc;
- ResizeMemoryHandler oldRealloc;
- DestroyMemoryHandler oldFree;
-
if ( magick !is null )
images[0].magick = magick;
if ( depth != 0 )
images[0].depth = depth;
- //Use the D GC to accolate the blob.
- GetMagickMemoryMethods(&oldMalloc, &oldRealloc, &oldFree);
- SetMagickMemoryMethods(&Image.malloc, &Image.realloc, &Image.free);
- scope(exit) SetMagickMemoryMethods(oldMalloc, oldRealloc, oldFree);
-
linkImages(images);
scope(exit) unlinkImages(images);
void* blob = ImagesToBlob(images[0].options.imageInfo, images[0].imageRef, &length, DMagickExceptionInfo());
- return blob[0 .. length];
+ void[] dBlob = blob[0 .. length].dup;
+ RelinquishMagickMemory(blob);
+
+ return dBlob;
}
/**