Image::write crashing with release (but not debug) DLLs
Posted: 2010-04-27T11:08:06-07:00
Hi, all.
I'm just getting started with IM and I wrote a little code to split a TIFF into multiple PNGs. I started with Visual Studio 2008 MFC App Wizard and generated a dialog-based application, then just dropped the following code into the OnInitDialog method.
std::list<Magick::Image> imgList;
std::list<Magick::Image>::iterator i;
char chName[MAX_PATH];
Magick::readImages(&imgList,"c:\\temp\\multipage_tiffs\\diary.tif");
if (!imgList.empty())
{
int nCnt;
for(nCnt = 0, i = imgList.begin();i != imgList.end(); i++, nCnt++)
{
_stprintf_s(chName,sizeof(chName),"c:\\temp\\im%02d.png",nCnt);
i->write(chName);
}
}
When I link with the release version of the DLLs (v 6.6.1-5), the program crashes on the "i->write" statement:
"Unhandled exception at 0x7855ae7a (msvcr90.dll) in TestImageMagick.exe: 0xc000000d: Access violation reading location 0xcccccccc."
When running with the debug version of the DLLs, it works just fine.
Any help would be appreciated.
I'm just getting started with IM and I wrote a little code to split a TIFF into multiple PNGs. I started with Visual Studio 2008 MFC App Wizard and generated a dialog-based application, then just dropped the following code into the OnInitDialog method.
std::list<Magick::Image> imgList;
std::list<Magick::Image>::iterator i;
char chName[MAX_PATH];
Magick::readImages(&imgList,"c:\\temp\\multipage_tiffs\\diary.tif");
if (!imgList.empty())
{
int nCnt;
for(nCnt = 0, i = imgList.begin();i != imgList.end(); i++, nCnt++)
{
_stprintf_s(chName,sizeof(chName),"c:\\temp\\im%02d.png",nCnt);
i->write(chName);
}
}
When I link with the release version of the DLLs (v 6.6.1-5), the program crashes on the "i->write" statement:
"Unhandled exception at 0x7855ae7a (msvcr90.dll) in TestImageMagick.exe: 0xc000000d: Access violation reading location 0xcccccccc."
When running with the debug version of the DLLs, it works just fine.
Any help would be appreciated.