Issue with toggle button

I am having some problems with toggle buttons/juce::AudioParameterBool

Not sure if this is due to my error or maybe some kind of bug.

I have some bools that I would like to set via the GUI e.g.,

bool sumInputToMono = true;

Following the pattern I learned for other variables I created a juce::AudioParameter

juce::AudioParameterBool* sumInputToMonoParam;

(I am not sure whether I am really going to need a separate bool member - maybe you can advise?)

In the pluginprocessor.cpp file I added:

addParameter(sumInputToMonoParam = new juce::AudioParameterBool("monoinput", "Mono Input", sumInputToMono));

When I build this, and add a toggle button to the GUI, I can see the parameter on the dropdown list of available parameters. I can assign the parameter to the toggle button. However when I click on it I get:

this is in juce_AudioProcessor.cpp

I noticed that i) before I assign the parameter I can toggle the switch
and ii) after I assign it it doesn’t through the exception till I click and iii) I think it may even happen when I click elsewhere in the View object I created to contain the toggle.

In the long run I am hoping to use the value of the parameter directly or to use it to set a bool that will then alter the sequence of dsp steps in processBlock().

This was reported before in this thread:

So it is probably not your fault.
So far the good news. Unfortunately I didn’t manage to reproduce the issue.

I am testing the develop branch and the SignalGenerator example used the ToggleButtons that are most likely at fault. However it is working in Logic and as Standalone.

I think it is some kind of update feedback loop, which only creates an error in debug mode. But it is still annoying.
In the main branch, I traced it down to setToggleState() sending bogus mouse clicks. I am not sure if that is still the case. I spent a day trying to reproduce it in a juce only project, but couldn’t verify my hypothesis…