SharedResourcePointer

That was rhetorical :wink: but thanks for the explanation

One thing I found surprising a while ago, and maybe posting it could save others from the same surprise (and debugging session): The API doc for DeletedAtShutdown says:

Classes derived from this will be automatically deleted when the application exits.

This is true if it’s a standalone app, but only half-true when it’s a plug-in. In a plugin, deletion happens when the number of loaded plugin instances goes to 0. That does happen when the host quits, but also when it finishes scanning your plug-in, or when you remove the last active instance from a track. So your code has to be ready to handle multiple shutdowns, and initialise again after a shutdown.

This could be another argument pro SharedResourcePointer, because it doesn’t use the word “shutdown” in the first place :slight_smile: Also the order of deletion is easy to reason about (just the standard C++ rules).

3 Likes