OS X 10.11, Reaper64
In my host vst plugin I have an AudioProcessorGraph that can load other vst’s. Say I load a child vst into the graph, open the child’s ui, and then remove the host vst. This causes a BAD_ACCESS in the destructor of the ScopedAutoReleasePool that gets destroyed at the end of ~JuceVSTWrapper():
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x00007fff86e8416f objc_release + 31
1 com.apple.CoreFoundation 0x00007fff8f7cbc12 _CFAutoreleasePoolPop + 50
2 com.apple.Foundation 0x00007fff8e94a9f5 -[NSAutoreleasePool release] + 146
3 com.myCompany.hostPlugin 0x0000000112139860 juce::ScopedAutoReleasePool::~ScopedAutoReleasePool() + 20
4 com.myCompany.hostPlugin 0x000000011221df8e JuceVSTWrapper::~JuceVSTWrapper() + 234
5 com.myCompany.hostPlugin 0x000000011221c8fe JuceVSTWrapper::~JuceVSTWrapper() + 14
6 com.myCompany.hostPlugin 0x000000011221b940 AudioEffect::dispatchEffectClass(AEffect, int, int, long long, void, float) + 48**
7 com.cockos.reaper 0x00000001003219a4 VST_HostedPlugin::~VST_HostedPlugin() + 308
8 com.cockos.reaper 0x000000010034b2b0 FxDsp::~FxDsp() + 544
9 com.cockos.reaper 0x000000010036c876 FxChain::dialogProc(HWND__*, unsigned int, unsigned long, long) + 8918
10 ??? 0x00010036a53e0000 0 + 281709677248512
I’ve narrowed it down to the graph’s destructor where it calls clearRenderingSequence() & deletes all the graph ops. If I prevent the ProcessBufferOp that’s associated with the child vst from being deleted here the crash does not occur (but assume would then leak).
I would guess that there’s some sort of double ownership going on here and something is getting deleted twice…
The really odd part is that the crash does not occur if the child vst’s ui is not instantiated.
Does anybody have tips on how to debug with an NSAutoReleasePool? What exactly is the purpose of having such a pool in ~JuceVSTWrapper()?