My previous question was answered related to the directly module exit of a plugin.
But what about the order of releasing the objects? I found, that some plugins seem to unexpectedly terminate, if the order is done differently. Is there a mandatory / recommened order ?
For a lot of plugins this order seems to work, but is it correct?
// if the plugview window is still open:
windowController->closePlugView(); // Steinberg::Vst::EditorHost::WindowController
App_editController->setComponentHandler(NULL); // Steinberg::Vst::IEditController*
vst3Processor->terminate(); // Steinberg::Vst::AudioClient*
_plugProvider = NULL; // Steinberg::IPtr<Steinberg::Vst::PlugProvider>
App_editController->release();
component->release(); // Steinberg::Vst::IComponent*
// optional ExitDll + FreeLibrary :
module = NULL; // VST3::Hosting::Win32Module::Ptr
SAFE_DELETE(m_ComponentHandlerPtr); // ComponentHandler*
App_editController = NULL;
component = NULL; // I use it as a pure pointer, so not DTOR called here
Should the order be changed? Its unclear for me, whether the plugins, which are still not closing properly, have internally a failure, or whether its caused by the order of releasing these objects…
Often an unexpected-termination occurs when calling FreeLibrary.
For most what I’ve experienced, the unexpected-termination-problem only occurs during unloading, if an edit controller plugview window was shown. When only opening the component without a plugview, on unloading module the termination does not occur in that faulty way.
Thank you!
My System OS: Windows 10 PRO 22H2