GDB Interrupted in Xcode when loading png files


#1

Hi,
I’m trying to load a png to use as a background image, but Xcode keeps being interrupted when it is trying to load.

The code was created using Jucer which used ImageCache::getFromMemory, but this resulted in build errors saying Symbol(s) not found.

Instead I used ImageFileFormat::loadFrom,

File img("Users/.../testimage.png");
cachedImage_testimage_png = (ImageFileFormat::loadFrom(img));

And this is where the interrupted error occurs…

Any suggestions?


#2

Re you sure your path is right there? From memory creating a file from an absolute path like that would look for a folder called “Users” in your root directory. You’re probably better off using the SpecialLocation enums. Something like

It may look longer but it’s clearer.

You should probably then do some error checking by either checking if the file exists and if it loaded the image correctly:

if(img.existsAsFile())
{
	cachedImage_testimage_png = ImageFileFormat::loadFrom(img);
	if(cachedImage_testimage_png.isValid)
	{
		//...do some stuff with the image here
	}
}

Also when your program gets interrupted bu GDB you should see either a callstack or juce assertion. These will be helpful in finding the specific cause.


#3

Yep using SpecialLocation fixed it!

Many thanks!