Hey Jules,
the bug spotter has another one:
juce_mac_MessageManager.mm: doPlatformSpecificShutdown() crashes Logic when you open up a plugin, close the GUI and afterwards remove the plugin from the insert -> BAD EXEC.
This doesn’t happen with the demo plugin but with any more advanced juce plugin I’ve checked.
But don’t worry, I already found a solution for this, you just have to put it to the official tip.
First the original version which leads to the crash:
[code]void MessageManager::doPlatformSpecificShutdown()
{
if (juceAppDelegate != 0)
{
[[NSRunLoop currentRunLoop] cancelPerformSelectorsWithTarget: juceAppDelegate];
[[NSNotificationCenter defaultCenter] removeObserver: juceAppDelegate];
// Annoyingly, cancelPerformSelectorsWithTarget can't actually cancel the messages
// sent by performSelectorOnMainThread, so need to manually flush these before quitting..
juceAppDelegate->flushingMessages = true;
for (int i = 100; --i >= 0 && numPendingMessages > 0;)
{
const ScopedAutoReleasePool pool;
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: 5 * 0.001]]; //!!!!!!! CRASHES HERE BECAUSE "numPendingMessages" ISN'T DECREASED IN TIME !!!!!!!!!!!!!!
}
[juceAppDelegate release];
juceAppDelegate = 0;
}
}[/code]
And this version works:
[code]void MessageManager::doPlatformSpecificShutdown()
{
if (juceAppDelegate != 0)
{
[[NSRunLoop currentRunLoop] cancelPerformSelectorsWithTarget: juceAppDelegate];
[[NSNotificationCenter defaultCenter] removeObserver: juceAppDelegate];
// Annoyingly, cancelPerformSelectorsWithTarget can't actually cancel the messages
// sent by performSelectorOnMainThread, so need to manually flush these before quitting..
juceAppDelegate->flushingMessages = true;
int currentNumPendingMessages = numPendingMessages;
for (int i = 100; --i >= 0 && currentNumPendingMessages > 0;)
{
const ScopedAutoReleasePool pool;
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: 5 * 0.001]];
--currentNumPendingMessages;
}
[juceAppDelegate release];
juceAppDelegate = 0;
}
}[/code]
Cheers,
Jan