AAX ComboBox problem under 5.4.x

I have a plugin that I’ve moved from JUCE 5.3.2 to 5.4.7, and changed from the old method of adding parameters to the new parameter layout method. I’m now using AudioParameterChoice for my drop-down-attached parameters. For VST3 and AU, this is working fine. But for AAX, something is causing the selection index returned when selecting an item from the list to be TWICE the index value that it should be. That makes all my selections (except the first one, at index 0) be incorrect, and causes a crash if I select any item more than half way down the list.

It’s as if using AudioParameterChoice, along with the ComboBox attachment, is causing each item to be added twice or something. The items only appear once, but the index that they return is twice what it should be. Any ideas how that could be? Should I be using a different parameter type? Or not adding the choices list to the parameter, and only using the drop-down’s list as it was entered in Projucer? Or…?

Actually, it’s this line that gives me the wrong value:

std::atomic<float>* pScaleValue = valueTreeState.getRawParameterValue("ScaP");

Not sure why someone here used std::atomic, or the reason for using getRawParameterValue(), and not the latest selection index. I’ll try using that instead. But it’s strange that the value returned by this is twice the actual index in the menu.

That doesn’t help, because the parameter is still getting 4 when I select item 2 (etc.). I don’t know where that is coming from (yet).

D’OH! Never mind. I was populating it with a global array, and it was populating the choices array twice because ProTools creates multiple instances (and my code didn’t clear the choices array before populating it).
This should only populate once, not once per instance. If I’m gonna share it, then I should use some kind of singleton pattern to make sure it only populates the array once. Either that, or make the arrays members of my processor.