ScopedAutoReleasePool / objc_msgSend EXC_BAD_ACCESS

Hello !

The usage I make of Juce my be a little bit tricky but,
I have a VST host based on Juce and a VST plugin based on the same version of Juce.

Both juce “instances” (from host in one hand, from plug-in in the other hand) are statically linked,
and I have used JUCE_NAMESPACE and JUCE_ObjCExtraSuffix defines with different values to insure that they do not conflict.

Unfortunately, on MacOSX, I get a EXC_BAD_ACCESS error when exiting:
with the following call stack:

objc_msgSend ?? _CFAutoreleasePoolPop NSPopAutoreleasePool -[NSAutoreleasePool release] juce_standalone::ScopedAutoReleasePool::~ScopedAutoReleasePool juce_standalone::JUCEApplication::main main
I get this error only when an AlertWindow is displayed by the plug-in (for instance, to inform user that an error occured).
If no AlertWindow is displayed, everything works fine.

What is wrong ?

From what I understood, the application may try to release twice the same object.
How to determine the class of this object ?

Thanks ahead,
Thomas

Do you mean that you’re quitting while a plugin is displaying a modal dialog (i.e. it’s sitting inside a modal loop)? If so, no wonder it crashes, and it’s impossible to do anything to avoid that!

Actually no,

The application first starts up,
then the modal dialog opens,
I click on “Ok” to close this dialog,
then close application
the crash occurs at that time

Ok… then I’m afraid I have no idea!

any idea about how to debug this ?

Not really.

One possibility is that the plugins are leaving behind some kind of obj-C object for auto-deletion, but that it doesn’t get cleaned up until the end of the run, at which point the plugin is no longer in memory, so the object’s destructor code no longer exists. Good old obj-C!