Changing Output Channel Creates New Instance of Plugin/Instrument In Logic Pro

Hey all!
Here’s the flow of my application.
NewProjectAudioProcessor(AudioProcessor)->NewProjectAudioProcessorEditor(AudioProcessorEditor)->MainContentComponent(inherits AudioAppComponent)->Synth

Essentially what’s happening is the Audio Processor gets a call to the createPluginFilter() which creates an instance of the newProjectAudioProcessorEditor with an instance of the mainContentComponent that takes the sampleRate and samplesPerBlock from the AudioProcessor. The mainContentComponent creates the UI and the synth instrument (SynthAudioSource) and passes it along a buffer to playback to via its getNextBlock method.

The problem I’m facing is that the every time I change the audioSource my application is creating a new instance of the Component and the interface which is causing all sorts of issue from buttons not clicking to playback not working. What’s a better way to go about this?
Thanks all!
Stevie

tldr; I was constructing multiple instances of the plugin but never destructing them when the audio device changed. Make sure to fill in your destructor folks!