Can you know your plugin is being deleted, in order to take some action?

Yes, I think this is the user’s problem. I really think that deleting the plugin while it’s outputting MIDI is not a common scenario, and if that results in stuck notes, that’s the user’s problem (and that’s honestly the behavior I would expect).

Yeah, I’m just so used to making sure that there are no stuck notes under every other circumstance, that I felt I should give it the old college try.

That’s not true. Perhaps you’re referring to virtual methods, which may not be accessible any more? Certainly normal member functions are still available. We use them all the time, calling functions to clean up for us instead of polluting the destructor itself with lots of code.

2 Likes

Apologies, I phrased it badly.
Of course you can call functions from the destructor.
And yes, the members are destroyed AFTER the destructor body has run.

But no other method can be called when the destructor started to run, like it would be the case, if processBlock() was still being called from the audio thread.

1 Like