audioProcessorEditor ownership / deleting in standalone

Hi, I’m trying to figure out how to manage freeing audioProcessorEditors in an audioApplication.

My understanding is that if createEditorIfNeeded() is called on an audioProcessor then the audioProcessor owns the editor and is responsible for deleting it when the application closes.

It doesn’t do it automatically because when I close I get an assertion in the AudioProcessor destructor that says “ooh nasty - the editor should have been deleted before it’s AudioProcessor”.

I’m not storing a reference to the editor outside of the processor, I have tried calling delete on the editor in the release resources and destructor methods to no avail.

Any help here would be much appreciated, it feels like something I only need to learn how to get right once.

I have uploaded a small project that shows my issue. Try building and running it then close the window and watch it assert.

Cheers N

EditorOwnershipTest.zip (7.3 KB)

I fixed the assertion by putting this in my audioProcessor destructor
if (auto* editor = getActiveEditor()) { editorBeingDeleted(editor); delete editor; }

A friend has pointed out that my window should probably not own the audiograph or nodes which may be why I am seeing this problem.

Both, the AudioProcessor and the AudioProcessorEditor are owned by the host. In the case of the stand-alone it’s the StandalonePluginHolder. The host is responsible to delete the editor before deleting the processor.

In the stand-alone you should not call createEditor yourself. Only the host should create the editor.

Oh interesting, thank you. I hadn’t seen the StandalonePluginHolder class.
I’m creating my own audio application that is using audioProcessors, graph and player.
I guess the ‘host’ is the DAW or application that is holding the audioProcessors, so I guess my question is more in relation to how to handle that side of things. ie. I am creating the host myself, I’m not intending on hosting anything in an existing DAW.