VST3: Release plugin factory before unloading plugin

This commit is contained in:
Robin Gareus 2020-09-20 20:51:26 +02:00
parent f386d1334a
commit a2e366ce28
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 18 additions and 2 deletions

View file

@ -1099,7 +1099,6 @@ VST3PI::VST3PI (boost::shared_ptr<ARDOUR::VST3PluginModule> m, int index, std::s
VST3PI::~VST3PI ()
{
_processor = 0;
terminate ();
}
@ -1128,6 +1127,10 @@ VST3PI::unit_data ()
void
VST3PI::terminate ()
{
deactivate ();
_processor = 0;
disconnect_components ();
bool controller_is_component = false;
@ -1136,9 +1139,18 @@ VST3PI::terminate ()
_component->terminate ();
}
if (_controller) {
_controller->setComponentHandler (0);
}
if (_controller && controller_is_component == false) {
_controller->terminate ();
}
if (_factory) {
_factory->release ();
}
_component = 0;
_controller = 0;
}

View file

@ -159,7 +159,6 @@ ARDOUR::discover_vst3 (boost::shared_ptr<VST3PluginModule> m, std::vector<VST3In
FUnknownPtr<Vst::IAudioProcessor> processor;
if (!(processor = FUnknownPtr<Vst::IAudioProcessor> (component))) {
cerr << "VST3: No valid processor";
//controller->terminate();
component->terminate ();
continue;
}
@ -177,11 +176,16 @@ ARDOUR::discover_vst3 (boost::shared_ptr<VST3PluginModule> m, std::vector<VST3In
nfo.n_midi_inputs = count_channels (component, Vst::kEvent, Vst::kInput, Vst::kMain);
nfo.n_midi_outputs = count_channels (component, Vst::kEvent, Vst::kOutput, Vst::kMain);
processor->setProcessing (false);
component->setActive (false);
//controller->terminate();
component->terminate ();
rv.push_back (nfo);
}
}
factory->release ();
return true;
}