mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 04:19:59 +02:00
Add manual reference counting to GetPluginFactory
Since even though we're passign raw pointers, it's expected that they are actually `IPtr<T>`s.
This commit is contained in:
@@ -81,13 +81,24 @@ Vst3PluginBridge::Vst3PluginBridge()
|
||||
overload{[&](const WantsConfiguration&)
|
||||
-> WantsConfiguration::Response { return config; }});
|
||||
});
|
||||
|
||||
// Set up the plugin factory, since this is the first thing the host will
|
||||
// request after loading the module. Host callback handlers should have
|
||||
// started before this since the Wine plugin host will request a copy of the
|
||||
// configuration during its initialization.
|
||||
plugin_factory = std::make_unique<YaPluginFactoryPluginImpl>(*this);
|
||||
sockets.host_vst_control.receive_into(
|
||||
WantsPluginFactory{}, *plugin_factory,
|
||||
std::pair<Vst3Logger&, bool>(logger, true));
|
||||
}
|
||||
|
||||
Steinberg::IPluginFactory* Vst3PluginBridge::get_plugin_factory() {
|
||||
// Even though we're working with raw pointers here, we should pretend that
|
||||
// we're `IPtr<Steinberg::IPluginFactory>` and do the reference counting
|
||||
// ourselves because you can't always safely pass those around
|
||||
if (plugin_factory) {
|
||||
plugin_factory->addRef();
|
||||
} else {
|
||||
// Set up the plugin factory, since this is the first thing the host
|
||||
// will request after loading the module. Host callback handlers should
|
||||
// have started before this since the Wine plugin host will request a
|
||||
// copy of the configuration during its initialization.
|
||||
plugin_factory = std::make_unique<YaPluginFactoryPluginImpl>(*this);
|
||||
sockets.host_vst_control.receive_into(
|
||||
WantsPluginFactory{}, *plugin_factory,
|
||||
std::pair<Vst3Logger&, bool>(logger, true));
|
||||
}
|
||||
|
||||
return plugin_factory.get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user