Page 1 of 1

Magick++ exception bug?

Posted: 2008-11-21T14:13:39-07:00
by mootools
Hello,

h_b_diff.png can be downloaded here

I think that there is a problem with Magick++ warning exceptions.
Ie. the following code crash on my png image which generate a warning.

Code: Select all

	Magick::Image image;
		try {
			// Read a file into image object
			image.read( "h_b_diff.png" );
		}
		catch( Warning& e)
		{
		}

		// Crop the image to specified size (width, height, xOffset, yOffset)
		image.crop( Geometry(100,100, 100, 100) );
The crash occurs because read throw a warning exception at that line:

Code: Select all

if ( image )
    throwException( image->exception );
and throwException deletes the exception (line DestroyExceptionInfo( &exception_ );)

So, when crop occurs we have:
image->exception.exceptions = NULL
and then the application crashes in InheritException / ResetLinkedListIterator at the beginning of CropImage (function CloneImage).

A better schema would be to not delete the exception when throwException is called with Magick::Image::image

Thanks,

Re: Magick++ exception bug?

Posted: 2008-11-21T17:03:48-07:00
by magick
We can reproduce the problem you posted and have a patch. Look for it in a few days in ImageMagick 6.4.6-1. Thanks.