Generic standalone - crash on exit in osx 64 bits

I made a generic standalone application that dynamically loads a vst. Here is the code, that loads
/Library/Audio/Plug-Ins/VST/test.VST


class JUCEHelloWorldApplication : public JUCEApplication
{
public:
    //==============================================================================
    JUCEHelloWorldApplication() {}
    
    //==============================================================================
    void initialise (const String& commandLine)
    {
        helloWorldWindow = new StandaloneFilterWindow("Hello", Colour(30, 30, 30), nullptr);
        helloWorldWindow->setVisible(true);
    }
    
    void shutdown()
    {
        // This method is where you should clear-up your app's resources..
        
        // The helloWorldWindow variable is a ScopedPointer, so setting it to a null
        // pointer will delete the window.
        helloWorldWindow = nullptr;
    }
    
    //==============================================================================
    const String getApplicationName()
    {
        return "Hello World for JUCE";
    }
    
    const String getApplicationVersion()
    {
        // The ProjectInfo::versionString value is automatically updated by the Jucer, and
        // can be found in the JuceHeader.h file that it generates for our project.
        return ProjectInfo::versionString;
    }
    
    bool moreThanOneInstanceAllowed()
    {
        return true;
    }
    
    void anotherInstanceStarted (const String& commandLine)
    {
    }
    
private:
    ScopedPointer<StandaloneFilterWindow> helloWorldWindow;
};
// This kicks the whole thing off..
START_JUCE_APPLICATION (JUCEHelloWorldApplication)

AudioProcessor* createPluginFilter()
{
    AudioPluginFormatManager formatManager;
    formatManager.addDefaultFormats();
    PluginDescription desc;
    desc.pluginFormatName = "VST";
    desc.fileOrIdentifier = "/Library/Audio/Plug-Ins/VST/test.VST";
    
    String errorMessage;
    return formatManager.createPluginInstance(desc, 44100.0f, 512, errorMessage);
}

This works well on OSX 32bits and all Windows flavors, but on OSX64, quitting the app causes the following crash:

Thread 0 Crashed:: Juce Message Thread  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                   0x00007fff841fd4d5 realizeClass(class_t*) + 34
1   libobjc.A.dylib                   0x00007fff841fd5bd realizeClass(class_t*) + 266
2   libobjc.A.dylib                   0x00007fff841f209f prepareForMethodLookup + 80
3   libobjc.A.dylib                   0x00007fff841f1eef lookUpMethod + 71
4   libobjc.A.dylib                   0x00007fff841f02fc objc_msgSend + 188
5   libobjc.A.dylib                   0x00007fff841f2236 _class_initialize + 310
6   libobjc.A.dylib                   0x00007fff841f20f3 prepareForMethodLookup + 164
7   libobjc.A.dylib                   0x00007fff841f1eef lookUpMethod + 71
8   libobjc.A.dylib                   0x00007fff841f02fc objc_msgSend + 188
9   com.apple.AppKit                  0x00007fff8c239401 -[NSView setNextKeyView:] + 314
10  com.apple.AppKit                  0x00007fff8c282c69 -[NSView _removeFromKeyViewLoop] + 94
11  com.apple.AppKit                  0x00007fff8c282476 -[NSView _finalizeWithReferenceCounting] + 784
12  com.apple.AppKit                  0x00007fff8c28213e -[NSView dealloc] + 42
13  com.apple.CoreFoundation          0x00007fff8688628a CFRelease + 170
14  com.apple.CoreFoundation          0x00007fff868c3efc -[__NSArrayI dealloc] + 140
15  libobjc.A.dylib                   0x00007fff841f4230 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 464
16  com.apple.CoreFoundation          0x00007fff868add72 _CFAutoreleasePoolPop + 34
17  com.apple.Foundation              0x00007fff885f447a -[NSAutoreleasePool drain] + 154

This happens with every VST I've tried, so I don't think the plugins are the cause. Any idea what's going wrong, and how to fix it ?

Thanks in advance,

P@

PS. Using Juce 3.0.1

Shall I repost this in "MacOSX specific issues" ?

No, but I have no idea what might be wrong.

And since you're using 3.0.1, there's no way I canĀ investigateĀ unless you show this to still happen in the latest code, and can give me some example code that replicates the problem.

Jules,

I tried the code above with a fresh git clone. It crashes just the same at shutdown, with every plugin I've tried.

The issue only happens on OSX 64bits.

Thanks,

'Tick

Try deleting the plugin's UI, then running the message loop for a moment, e.g. 1 sec, then deleting the plugin, then running the message loop again, and then quit. Sometimes the obj-C runtime gets into a mess if you unload a DLL before the UI objects have had a chance to clean themselves up.