BR: Plugin hosting now crashes on jbridged plugins

To reproduce:

  • Build a 64 bit host
  • Install latest jbridge
  • Bridge some 32 bit plugins
  • Add some 32 bit effects
  • Crash

Getting reports of other plugins crashing too.

Started with this change here: VST Host: Correctly retrieve results of effGetSpeakerArrangement · juce-framework/JUCE@36653e8 · GitHub

The 64-bit AudioPluginHost is able to run 32-bit jbridged versions of the MIDILogger and DSPModulePluginDemo with crashing. 32-bit Surge 1.6.0 and FabFilter Pro-Q 1.23 (both non-JUCE plugins) also work correctly. I can stick a breakpoint in getSpeakerArrangementWrapper and see that and result.out both (appear to) point to non-garbage VstSpeakerArrangement instances when the dispatchResult is not 0.

Please can you provide some examples of 32-bit plugins which cause a crash? Can you also confirm that the same plugins work as expected when bridged to non-JUCE 64-bit hosts?

It’s compiler dependent. It will crash for me in VS2017, but not VS2019. The call stack I get is:

 	Bridger64.dll!00007ffea58b97ad()	Unknown
 	Bridger64.dll!00007ffea58c5865()	Unknown
 	Bridger64.dll!00007ffea58c90e9()	Unknown
 	Bridger64.dll!00007ffea58c6952()	Unknown
>	Waveform 11 (64-bit).exe!juce::VSTPluginInstance::getSpeakerArrangementWrapper(Vst2::AEffect * effect) Line 2308	C++
 	Waveform 11 (64-bit).exe!juce::VSTPluginInstance::pluginHasDefaultChannelLayouts(Vst2::AEffect * effect) Line 2262	C++
 	Waveform 11 (64-bit).exe!juce::VSTPluginInstance::queryBusIO(Vst2::AEffect * effect) Line 2195	C++
 	Waveform 11 (64-bit).exe!juce::VSTPluginInstance::create(const juce::ReferenceCountedObjectPtr<juce::ModuleHandle> & newModule, double initialSampleRate, int initialBlockSize) Line 1149	C++
 	Waveform 11 (64-bit).exe!juce::VSTPluginFormat::createPluginInstance(const juce::PluginDescription & desc, double sampleRate, int blockSize, std::function<void __cdecl(std::unique_ptr<juce::AudioPluginInstance,std::default_delete<juce::AudioPluginInstance> >,juce::String const &)> callback) Line 3561	C++
 	Waveform 11 (64-bit).exe!juce::AudioPluginFormat::createInstanceFromDescription(const juce::PluginDescription & desc, double initialSampleRate, int initialBufferSize, juce::String & errorMessage) Line 67	C++
 	Waveform 11 (64-bit).exe!juce::AudioPluginFormatManager::createPluginInstance(const juce::PluginDescription & description, double rate, int blockSize, juce::String & errorMessage) Line 96	C++

The exception I get is:

Exception thrown at 0x00007FFEA58B97AD (Bridger64.dll) in Waveform 11 (64-bit).exe: 0xC0000005: Access violation reading location 0x0000000000000202.

And the contents of SpeakerArrangements results is:

-		result	{in=0x0000000000000202 {type=??? numChannels=??? speakers=0x000000000000020a {{azimuth=??? elevation=...}, ...} } ...}	juce::VSTPluginInstance::SpeakerArrangements

It crashing on the nonsense pointer value in results.

If SpeakerArrangements has a constructor that initializes the pointers to nullptr then it doesn’t crash. In VS2019 I think it just happens to be luck that the pointers are initialized with nullptr.

I can get it to crash every time with Abstract Chamber 32-bit Download Free Modulated reverb plugin: Abstract Chamber by Signaldust

Thanks, I can trigger a crash if I initialise the SpeakerArrangements with non-null pointers. Forcing the pointers to be initialised to null fixes the issue, as you said, so I’ll push that change.