Hi,
I think there is a bug either in the VST3 wrapper or in the juce plugin host. Here is how to trigger the crash:
Add these lines in the processBlock() of MultiOutSynth:
for (int c=0; c < buffer.getNumChannels(); ++c) {
float *p = buffer.getWritePointer(c);
*p = 0;
}
(they just make sure we are trying to write in each output channel of the supplied AudioSampleBuffer)
Build the plugin with “Address Sanitizer” enabled in xcode.
Open the VST3 in the Juce Plugin Host. Select ‘Configure Audio I/O’. Disable bus #2 (the UI is maybe a bit buggy so it may need more than one click on the checkbox to get it really disabled). When closing the ‘Configure Audio I/O’ , I’m getting this crash:
==91715==ERROR: AddressSanitizer: heap-use-after-free on address 0x6310000a2110 at pc 0x000118fd0d06 bp 0x700002b3b850 sp 0x700002b3b848
WRITE of size 4 at 0x6310000a2110 thread T5
#0 0x118fd0d05 in MultiOutSynth::processBlock(juce::AudioBuffer<float>&, juce::MidiBuffer&) MultiOutSynth.cpp:101
#1 0x118f8a163 in void juce::JuceVST3Component::processAudio<float>(Steinberg::Vst::ProcessData&, juce::Array<float*, juce::DummyCriticalSection, 0>&) juce_VST3_Wrapper.cpp:2143
#2 0x118f6b8c8 in juce::JuceVST3Component::process(Steinberg::Vst::ProcessData&) juce_VST3_Wrapper.cpp:1957
#3 0x118f6bbab in non-virtual thunk to juce::JuceVST3Component::process(Steinberg::Vst::ProcessData&) juce_VST3_Wrapper.cpp:1926
#4 0x105ada468 in void juce::VST3Classes::VST3PluginInstance::processAudio<float>(juce::AudioBuffer<float>&, juce::MidiBuffer&, Steinberg::Vst::SymbolicSampleSizes) juce_VST3PluginFormat.cpp:2030
#5 0x105ad1794 in juce::VST3Classes::VST3PluginInstance::processBlock(juce::AudioBuffer<float>&, juce::MidiBuffer&) juce_VST3PluginFormat.cpp:1992
#6 0x105abd385 in juce::GraphRenderingOps::ProcessBufferOp::callProcess(juce::AudioBuffer<float>&, juce::MidiBuffer&) juce_AudioProcessorGraph.cpp:281