VST3: cleanup component, release resources

This fixes a hang at exit (in FreeLibrary, dlclose) for some
VST3 plugins.
This commit is contained in:
Robin Gareus
2020-09-20 23:06:27 +02:00
parent a2e366ce28
commit 8754090c47
2 changed files with 11 additions and 4 deletions

View File

@@ -1003,17 +1003,19 @@ VST3PI::VST3PI (boost::shared_ptr<ARDOUR::VST3PluginModule> m, int index, std::s
if (!_controller) {
_component->terminate ();
_component->release ();
throw failed_constructor ();
}
if (_controller->setComponentHandler (this) != kResultOk) {
_component->terminate ();
_component->release ();
throw failed_constructor ();
}
if (!(_processor = FUnknownPtr<Vst::IAudioProcessor> (_component))) {
//_controller->terminate();
_component->terminate ();
_component->release ();
throw failed_constructor ();
}
@@ -1031,6 +1033,7 @@ VST3PI::VST3PI (boost::shared_ptr<ARDOUR::VST3PluginModule> m, int index, std::s
if (!connect_components ()) {
//_controller->terminate(); // XXX ?
_component->terminate ();
_component->release ();
throw failed_constructor ();
}
@@ -1147,12 +1150,15 @@ VST3PI::terminate ()
_controller->terminate ();
}
_component->release ();
if (_factory) {
_factory->release ();
}
_component = 0;
_controller = 0;
_component = 0;
_factory = 0;
}
bool

View File

@@ -152,7 +152,6 @@ ARDOUR::discover_vst3 (boost::shared_ptr<VST3PluginModule> m, std::vector<VST3In
if (component->initialize (HostApplication::getHostContext ()) != kResultOk) {
cerr << "Failed to initialize VST3 component\n";
//component->terminate();
continue;
}
@@ -160,12 +159,14 @@ ARDOUR::discover_vst3 (boost::shared_ptr<VST3PluginModule> m, std::vector<VST3In
if (!(processor = FUnknownPtr<Vst::IAudioProcessor> (component))) {
cerr << "VST3: No valid processor";
component->terminate ();
component->release ();
continue;
}
if (processor->canProcessSampleSize (Vst::kSample32) != kResultTrue) {
cerr << "VST3: Cannot process 32bit float";
component->terminate ();
component->release ();
continue;
}
@@ -179,8 +180,8 @@ ARDOUR::discover_vst3 (boost::shared_ptr<VST3PluginModule> m, std::vector<VST3In
processor->setProcessing (false);
component->setActive (false);
//controller->terminate();
component->terminate ();
component->release ();
rv.push_back (nfo);
}
}