[BUG] VST3 Preset parameter with legacy param IDs crash

We have plugin that is using JUCE_FORCE_USE_LEGACY_PARAM_IDS. During update from JUCE 5.4.7 to JUCE 6.0.7 we have encountered crash while loading VST3 plugin. It seems that new Preset Parameter is causing nullptr crash on Windows 10. Tested in Reaper and Wavelab. I think it might be correlated with this commit:

Steps to reproduce:

  • create new plugin project
  • set up JUCE_FORCE_USE_LEGACY_PARAM_IDS to “Enabled”
  • set up getNumPrograms() in PluginProcessor to return more than 1 program

I have changed in VST3 Wrapper in line 1078 comparison from JuceAudioProcessor::paramPreset to last parameter. For example in plugin that has 47 parameters in total (with preset parameter and bypass parameter) to 46. In minimal project that I have created to extract issue I have changed it to 1. It is helping to load project, but I don’t know if it is not messing with something else. I hope it will help to reproduce and fix that bug.

Thank you for reporting and for the detailed steps to reproduce the issue. We’ve added a fix for this to the develop branch:

Thank you @ed95 for fast reply and fixing that.
Unfortunately I have more complicated example that still is not working properly. Adding bypass parameter inside PluginProcessor is causing wrong parameter calculation and is still crashing.

I have added inside PluginProcessor.h:

juce::AucioProcessorParameter* getBypassParameter() const override;

std::unique_ptrjuce::AudioParameterBool bypassParam;

and inside PluginProcessor.cpp in initializer list:

, bypassParam(new juce::AudioParameterBool(“byps”, “Bypass”, false, {}, {}, {}))

and implementation of getBypassParameter():

juce::AudioProcessorParameter* ProgramParamTestAudioProcessor::getBypassParameter() const
return bypassParam.get();

I am using juce 6.0.8. Crash is happening in juce_VST3_Wrapper.cpp in line 527. AudioProcessor is showing that bypassParamID and programParamID are both set to 0. I think programParamID is calculated incorrectly while PluginProcessor is providing bypassParameter. Could you check this as well?

I am also having an issue with JUCE_FORCE_USE_LEGACY_PARAM_IDS = 1.

Thanks for reporting. This should now be fixed on develop:

1 Like

Thank you! Now it is working for our plugin.