Signal 11: SIGSEGV when using AudioProcessorValueTreeState::Listener

I had an AudioProcessorValueTreeState object in PluginProcessor and AudioPluginAudioProcessorEditor inherited from AudioProcessorValueTreeState::Listener. The parameter is attached to a slider using another AudioProcessorValueTreeState::SliderAttachment object.

I tested it in the stand alone mode and it works fine. If opening the VST using JUCE’s AudioPluginHost though, once changing the parameter the program crashed. The error was: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV). The line trigger the error was from line 151 of juce_AudioProcessorValueTreeState.cpp

void parameterValueChanged (int, float) override
        const auto newValue = denormalise (parameter.getValue());

        if (unnormalisedValue == newValue && ! listenersNeedCalling)

        unnormalisedValue = newValue;
    --> ([this] (Listener& l) { l.parameterChanged (parameter.paramID, unnormalisedValue); });
        listenersNeedCalling = false;
        needsUpdate = true;

I noticed the message in the parameterChanged(const juce::String &parameterID, float newValue) callback was printed successfully though. Any suggestions?

PluginEditor.cpp (1.0 KB)
PluginEditor.h (1.0 KB)
PluginProcessor.cpp (6.6 KB)
PluginProcessor.h (2.2 KB)

1 Like

If you add a parameter listener in the editor’s constructor, you need to remove the listener in the editor’s destructor (or as soon as the listener is no longer required).


Thank you for the help.