why readImages() function does not catch the exception?

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
JeongSeok, Yang
Posts: 2
Joined: 2013-08-16T00:44:02-07:00
Authentication code: 6789

why readImages() function does not catch the exception?

Post by JeongSeok, Yang »

Image Magick version: ImageMagick-6.7.5-2
System: Linux

When I try to open the file that is maybe not a real image file,
The below codes works differently at Magick::readImages().
I'd like to know why.
The input file is here( http://cfile221.uf.daum.net/attach/262A ... E0F60D8E69 )

On the Ubuntu system,
Linux ubuntu 3.8.0-27-generic #40-Ubuntu SMP Tue Jul 9 00:17:05 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux (by $ uname -a )
The exception is caught by well at the line of "catch (Magick::Exception & e)"
I think this is a normal behavior.

But on the Radhat system
Linux s-receiver7 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux (by $ uname -a )
It just causes crash whitout catching the exception.
That is , it showes "Segmentation fault".

What should I check?

I hope it works like it does on the Ubuntu system.

bool openFile(Image &image, const string & path) {
list<Image> image_list;

try {
Magick::readImages(&image_list, path);
} catch (Magick::Exception & e) {
cerr<<"what(): "<<e.what()<<endl;
return false;
} catch (...) {
cerr << "ImageMagick::openFile() - exception catch(...)" << endl;
return false;
}
image = image_list.front();
return true;
}

Thanks.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: why readImages() function does not catch the exception?

Post by dlemstra »

Are you using the same version of ImageMagick on both servers?
Last edited by dlemstra on 2013-08-16T02:49:32-07:00, edited 1 time in total.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
JeongSeok, Yang
Posts: 2
Joined: 2013-08-16T00:44:02-07:00
Authentication code: 6789

Re: why readImages() function does not catch the exception?

Post by JeongSeok, Yang »

Yes I am using the same version on the server and on Unbuntu desktop.
Post Reply