Image problem after xCode update


#1

Hi
I ran into a problem after updating xCode to version 10.0

The problem is in my MacOS application version only. The same app runs without issues on Windows.
It seems that drawing images that has been clipped (sometimes) makes the app crash.

I can reproduce the issue by adding a few lines of code to the DemoRunner project.
In the IntroScreen class I add these lines to the paint method:

Image artistImage =ImageFileFormat::loadFrom(String("/Users/Shared/Projects/JUCE/examples/DemoRunner/Source/JUCEAppIcon copy.png"));
Rectangle imageCrop((int)50, (int)0, (int)400, (int)400);

    Image croppedArtistImage = artistImage.getClippedImage(imageCrop);
    

    g.drawImageWithin(
                      croppedArtistImage,
                      10,
                      10,
                      100,
                      100,
                      RectanglePlacement(RectanglePlacement::centred));

If I resize the image to 640x400 pixels before running the code it will crash. Sometimes it has to run for a while before it crashes and other times it crashes at the first call to paint.

If the image is left in the original (smaller) size it doesn’t crash.
If I dont clip the image it doesn’t crash.
If I add .duplicateIfShared() to the croppedArtistImage it doesn’t crash.

The stack trace shows that we end up in some code with a buffer that is too small:

Any help is highly appreciated.
Best regards
John


Crashes with juce::Image / CoreGraphics / iOS 12
Slider::setPopupDisplayEnabled() causes crash on iOS 12
Mojave compatibility
#2