Page 1 of 1

No exception with missing dir [SOLVED]

Posted: 2012-08-24T11:35:32-07:00
by insomniacp
Hi,
I am using the following code as a test case.

Code: Select all

#include <Magick++.h> 
#include <iostream>
using namespace std;
using namespace Magick;
int main()
{
	Image test;
	string url = "http://skreened.com/c/keuhxtodipbpomnwupfz";
	try{
		test.read(url);
	} catch(Exception e)
	{
		cout <<e.what()<<endl;
	}
	if(test.columns()>1)
	{
		try{
		cout <<"writing file"<<endl;
		test.write("data/content/k/e/u/keuhxtodipbpomnwupfz.mpc");
		} catch(Exception e)
		{
			cout <<"Doesn't get here ?"<<e.what()<<endl;
		}
	}
	cout <<"done with program"<<endl;
	return 0;
}
This code produces the following output on Linux:
Magick: Ignoring attempt to set cHRM RGB triangle with zero area `/tmp/magick-UwS1UjvY' @ warning/png.c/MagickPNGWarningHandler/1777
writing file
testApp: magick/hashmap.c:466: GetLastValueInLinkedList: Assertion `list_info != (LinkedListInfo *) ((void *)0)' failed.
Aborted
This occurs when the directories do not exist. My wonder is why this does not throw an exception as it has for all of my other files. My implementation will create the directory structure if an Exception is thrown and then try again. For some reason this file causes a hard abort while other ones throw exceptions like this url "http://skreened.com/c/nztmsatqnreougcsqusq". This url produces the following output
writing file
Doesn't get here ?Magick: unable to open image `data/content/k/e/u/keuhxtodipbpomnwupfz.mpc': No such file or directory @ error/blob.c/OpenBlob/2642
done with program
This is what I would expect to happen and is what I handle in my main implementation. The only reason I can think is that failed assertion is causing some problem. Though for all I know the image could be causing the problem as well but I am unsure how to check that is it works if you direct your browser to that link or open it in another program. It also works fine if the directory structure exists which has thrown me for a loop as well unless you have multiple ways of saving a file and its using one that does not throw an exception for some reason.

Thanks for the help.

Re: No exception with missing dir

Posted: 2012-08-24T11:45:31-07:00
by magick
We can reproduce the problem you posted and have a patch. Look for it in ImageMagick 6.7.9-2 by sometime tomorrow. Thanks.