Synthesiser and OwnedArray of SynthesiserVoices Problem

I’m trying to figure out how to properly manage the memory of my class that has both a Synthesiser and an OwnedArray of SynthesiserVoices which are added to the Synthesiser class instance in the constructor. Upon exiting the app, I get a bad access because it seems that the synthesiser voices are being deleted in two different locations. I’m guessing one is in the Synthesiser class and the other in the OwnedArray class.

I would like to be able to allocate and deallocate voices as I like without this problem occurring. Does anyone have any ideas as to how to solve this? Must I simply declare my own synthesiser class that will hold the OwnedArray of voices? Trying to figure out the best way to procede. Thanks!

The docs actually point that out Synthesiser::addVoice():

The object passed in will be managed by the synthesiser, which will delete it later on when no longer needed. The caller should not retain a pointer to the voice.

You can remove them as you wish calling removeVoice (int index), which will trigger the deletion, just like an OwnedArray would do.