Skip to content

Commit

Permalink
Merge pull request #239 from emcconville/issue-237
Browse files Browse the repository at this point in the history
Proposed fix for issue #237 - Sequence not clearing from memory
  • Loading branch information
dahlia committed May 18, 2015
2 parents 688deac + 7a392c8 commit a4d126e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/changes.rst
Expand Up @@ -32,6 +32,8 @@ Version 0.4.1
- Render RGB :class:`Color <wand.color.Color>` preview.
- Display each frame in image :class:`Sequence <wand.sequence.Sequence>`.

- Fixed memory-leak when accessing images constructed in
:class:`Image.sequence[] <wand.sequence.Sequence>`. [:issue:`237` by Eric McConville]
- Fixed Windows memory-deallocate errors on :mod:`wand.drawing` API. [:issue:`226` by Eric McConville]


Expand Down
3 changes: 3 additions & 0 deletions wand/api.py
Expand Up @@ -589,6 +589,9 @@ class AffineMatrix(ctypes.Structure):
libmagick.DestroyExceptionInfo.argtypes = [ctypes.c_void_p]
libmagick.DestroyExceptionInfo.restype = ctypes.c_void_p

libmagick.DestroyImage.argtypes = [ctypes.c_void_p]
libmagick.DestroyImage.restype = ctypes.c_void_p

library.MagickGetSize.argtypes = [ctypes.c_void_p,
ctypes.POINTER(ctypes.c_uint),
ctypes.POINTER(ctypes.c_uint)]
Expand Down
1 change: 1 addition & 0 deletions wand/sequence.py
Expand Up @@ -128,6 +128,7 @@ def __getitem__(self, index):
single_image = libmagick.CloneImages(image, binary(str(index)), exc)
libmagick.DestroyExceptionInfo(exc)
single_wand = library.NewMagickWandFromImage(single_image)
single_image = libmagick.DestroyImage(single_image)
library.MagickSetIteratorIndex(wand, tmp_idx)
instance = SingleImage(single_wand, self.image, image)
self.instances[index] = instance
Expand Down

0 comments on commit a4d126e

Please sign in to comment.