Static juce::Image causing freeze on exit

Hi,

After updating a plugin from JUCE 7 to JUCE 8.0.4, users began reporting freezes on Windows for specific DAW’s like FL Studio and Cubase, on exiting the DAW. I found that some juce::Image in my code I declared as static (initialized using juce::ImageCache::getFromMemory). Removing the static keyword resolved the issue.

I’m fine with not using static, but I’m curious what JUCE change causes this change of behaviour (because it worked fine before updating JUCE).

Best,
Jelle

static objects are shared between all plugins in the same process… so did you have any other instances of the plugin instantiated when you quit? It may be related to the recent singleton change??

Rail

I’m aware that statics are shared between plugins. I don’t think this is related though. I had only a single plugin instantiated when quiting.

Also not the answer you are looking for, but there is no need to keep an image static when it is in the ImageCache. The ImageCache is a singleton and keeps a shared copy of your image.

It could be related to the Direct2D, where Image might be backed in GPU memory and rely on the proper freeing of the image. But that’s just a wild guess.

2 Likes