I have a VST that hosts other VSTs within it. When my VST is loaded, it starts by scanning the usual locations for AU plugins. I do this by spawning a few std::threads and passing them a PluginDirectoryScanner. Each thread just calls PluginDirectoryScanner::scanNextFile() until it returns false.
It works pretty much exactly like the plugin host demo.
However, after scanning a few plugins, it eventually crashes with a SIGABRT error. In the terminal, I see the message, "libc++abi.dylib: Pure virtual function called!"
Here is the stack trace (it's totally unhelpful):
Juce Message Thread (1)Queue : com.apple.main-thread (serial) #0 0x00007fff98e79002 in __pthread_kill () #1 0x000000010117c44e in pthread_kill () #2 0x00007fff9160e6e7 in abort () #3 0x00007fff87b7bf81 in abort_message () #4 0x00007fff87ba04dc in __cxa_pure_virtual () #5 0x00007fff87c9abc4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ () #6 0x00007fff87c9a853 in __CFRunLoopDoTimer () #7 0x00007fff87d18e6a in __CFRunLoopDoTimers () #8 0x00007fff87c55cd1 in __CFRunLoopRun () #9 0x00007fff87c55338 in CFRunLoopRunSpecific () #10 0x00007fff88547935 in RunCurrentEventLoopInMode () #11 0x00007fff8854776f in ReceiveNextEventCommon () #12 0x00007fff885475af in _BlockUntilNextEventMatchingListInModeWithFilter () #13 0x00007fff866c20ee in _DPSNextEvent () #14 0x00007fff86a8e943 in -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] () #15 0x00007fff866b7fc8 in -[NSApplication run] () #16 0x00000001002758b3 in juce::MessageManager::runDispatchLoop() at /Users/kevin/Projects/JUCE/modules/juce_events/native/juce_mac_MessageManager.mm:248 #17 0x000000010027579a in juce::JUCEApplicationBase::main() at /Users/kevin/Projects/JUCE/modules/juce_events/messages/juce_ApplicationBase.cpp:240 #18 0x00000001002755ac in juce::JUCEApplicationBase::main(int, char const**) at /Users/kevin/Projects/JUCE/modules/juce_events/messages/juce_ApplicationBase.cpp:218 #19 0x0000000100011533 in main at /Users/kevin/Projects/JUCE/examples/audio plugin host/Source/HostStartup.cpp:119 #20 0x00007fff873de5ad in start ()
The weird thing is that if I block the main thread while the scan is in progress, it doesn't crash, and the scan finishes successfully.
I've been banging my head on the wall on this one for a while now. Hoping you guys might have some ideas. Thanks in advance!