Well, I did post all of it in the first post, and a github link.
It’s pretty vexing. Some have published plug-ins that load plug-ins. I’ve requested some kind of documentation or a tutorial, because I’m not the only one who wants to do it. I’m planning to release this GPL, and if I ever figure this out, I will write it up for others.
Now I’m getting something very odd. I get exceptions on closing Audio Plugin Host, in two different places, both on: jassert (activeEditor == nullptr);
And yet I didn’t actually change my code.
Thank you very much for helping.
Could this be the reason for your double delete? 
The jassert you are facing is there, because if the editor is alive while the processor is deleted, the processor reference in the editor leads to a crash when accessed.
Well, I’ve since tried several ways without that delete command.
I’ve just pushed my latest version.
I can initialize wrappedEditor in the initializer list, thus avoiding the problem of casting a raw pointer.
Without that delete command in the processor destructor, it still gives me an exception.
That delete command was aimed at the pointer returned by its getActiveEditor command. It’s out now.
I would leave getActiveEditor() and createEditorIfNeeded() alone. The host is allowed to create more than one editor.
Instead call createEditor() in your getWrappedEditor, that’s why I changed the name to createWrappedEditor in my advice above. The processor creates an editor that is only owned in the wrapper editor.
Before, if two editors were created, they both own the activeEditor, but each one should have it’s own copy.
Ah, I understand. Wow.
I was just thinking how I take ownership of the wrapped editor with a unique_ptr, but immediately use its get() raw pointer to make it the child of my editor. Wouldn’t that open up a double delete situation? If the editor deletes its child, but the unique-ptr also wants to delete it when it goes out of scope?
I had tried createEditor as you said, but I reverted because I didn’t quite comprehend what you’re saying now. I’ll try again tomorrow, and I’m sure it will be resolved. At least that’s how I’ll be able to sleep tonight.
Regardless, I certainly owe you a couple cold brews from my hometown by now.
If you look at the children list in the Component (addAndMakeVisible), it is a list of raw pointers. It is not owning. Every Component knows it’s parent and is responsible to remove itself when being deleted.
Who knows, maybe we get the chance to have some together…
I’ve made a tiny bit of progress.
If, instead of loading a VST3 plug-in from a file, I include the source for a different AudioProcessor, and attach a GenericAudioProcessorEditor to it, I have neither of these problems:
- The wrapped editor is visible no matter how many times I open and close the wrapper editor;
- There is no double delete occurring when the AudioProcessor is deleted.
While using a wrapped VST3, #1 is a problem if I don’t take ownership of the wrapped editor, and #2 is a problem if I do. While using an editor compiled from source, neither one is a problem!
So, apparently, something is going off in the VST wrapper source.
I suppose the next step is to see if it works OK loading the same simple AudioProcessor compiled as a VST3 plug-in.
