When to free Resources

Hi there.
IMy plugin has some worker threads, which I try to join in the destrucror of my plugin class, but it never gets called, making the plugin host to stay in background when shutdown, and I need to kill it by hand from shell.
So is there a method to override that gets called when host closes my plugin? Been searching forever and could not find any info.
Kind regards

Could not find an option to delete or edit this post. But this post can be deleted. The destructors get called, but only when the daw closes. Everything. is clear now.

1 Like

The plugin destructor should get called when you delete the plugin from a track etc

Yes the desctructor of the plugin gets called when the plugin gets removed from the track. I thought it would not, because I did not see the destructors of my own classes get called, which are constructed outside any methods using the extern keyword. This works well for an app, but for a plugin it prevents multiple instances as those objects are shared between instances.
So now I am wondering where to store and how to access a pointer to an object that contains a lot of instance specific variables, objects etc. which is defined and used in another library that knows nothing about iPlug. Having a pointer declared extern does not work, because this prevents multiple plugin instances.

Guess Ill have to rewrite a lot of code, passing the pointer as function argument where needed.