I use PluginContextFactory::instance().getPluginContext() for all instances of the plugin (in parallel, module loaded after unloaded, instaniating).
Do I need such a PluginContextFactory instance for each plugin instance independently?
My own VST3-SDK-based host can load VST3 plugins and run them.
The first few times its initialized anything works fine. But when adding/removing instances of the same plugin, it sometimes (not always) crashes on a later instaniating of the plugin instance and I suspected this plugin-context-factor-instance to be the reason.
the hostContext could be global… maybe there was a refcounting issue… you could secure your hostContext by disabling the refcounting, just overwrite like this:
uint32 PLUGIN_API addRef () override { return 1; }
uint32 PLUGIN_API release () override { return 1; }
in class HostApplicationhere in file hostclasses.h I added the 2 lines of your previous post. But the compiler complains:
error C2535: “Steinberg::uint32 Steinberg::Vst::HostApplication::addRef(void)”: member function already defined or declared,
cause its already defined here this way in hostclasses.cpp
So the refcounting seems not to be the reason. Will investigate further, when the crash again occurs. Thanks for your help!