-
-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IM ExceptionInfo were not being freed correctly. This patch adds a small wrapper function and uses it to allocate and free all IM exception objects. Tested with im 6.9 and gm 1.3. See: libvips/lua-vips#24 #1203
- Loading branch information
Showing
7 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,18 @@ magick_set_property( Image *image, const char *property, const char *value, | |
(void) SetImageProperty( image, property, value, exception ); | ||
} | ||
|
||
ExceptionInfo * | ||
magick_acquire_exception( void ) | ||
{ | ||
return( AcquireExceptionInfo() ); | ||
} | ||
|
||
void | ||
magick_destroy_exception( ExceptionInfo *exception ) | ||
{ | ||
VIPS_FREEF( DestroyExceptionInfo, exception ); | ||
} | ||
|
||
void | ||
magick_inherit_exception( ExceptionInfo *exception, Image *image ) | ||
{ | ||
|
@@ -197,12 +209,48 @@ magick_set_property( Image *image, const char *property, const char *value, | |
#endif /*HAVE_SETIMAGEPROPERTY*/ | ||
} | ||
|
||
ExceptionInfo * | ||
magick_acquire_exception( void ) | ||
{ | ||
ExceptionInfo *exception; | ||
|
||
#ifdef HAVE_ACQUIREEXCEPTIONINFO | ||
/* IM6+ | ||
*/ | ||
exception = AcquireExceptionInfo(); | ||
#else /*!HAVE_ACQUIREEXCEPTIONINFO*/ | ||
/* gm | ||
*/ | ||
exception = g_new( ExceptionInfo, 1 ); | ||
GetExceptionInfo( exception ); | ||
#endif /*HAVE_ACQUIREEXCEPTIONINFO*/ | ||
|
||
return( exception ); | ||
} | ||
|
||
void | ||
magick_destroy_exception( ExceptionInfo *exception ) | ||
{ | ||
#ifdef HAVE_ACQUIREEXCEPTIONINFO | ||
/* IM6+ will free the exception in destroy. | ||
*/ | ||
VIPS_FREEF( DestroyExceptionInfo, exception ); | ||
#else /*!HAVE_ACQUIREEXCEPTIONINFO*/ | ||
/* gm and very old IM need to free the memory too. | ||
*/ | ||
if( exception ) { | ||
DestroyExceptionInfo( exception ); | ||
g_free( exception ); | ||
} | ||
#endif /*HAVE_ACQUIREEXCEPTIONINFO*/ | ||
} | ||
|
||
void | ||
magick_inherit_exception( ExceptionInfo *exception, Image *image ) | ||
{ | ||
#ifdef HAVE_INHERITEXCEPTION | ||
#ifdef HAVE_INHERITEXCEPTIONINFO | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jcupitt
Author
Member
|
||
InheritException( exception, &image->exception ); | ||
#endif /*HAVE_INHERITEXCEPTION*/ | ||
#endif /*HAVE_INHERITEXCEPTIONINFO*/ | ||
} | ||
|
||
void | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HAVE_INHERITEXCEPTIONINFO
->HAVE_INHERITEXCEPTION
?