Is it safe to call GetPluginFactory() in InitModule()?

SDK for VST 3 audio plug-in and host development.
ray
Posts: 81
Joined: Fri Sep 02, 2016 9:37 am

Is it safe to call GetPluginFactory() in InitModule()?

Postby ray » Fri Jun 22, 2018 4:00 pm

Doing the above causes a crash in Studio One 3.5 on Windows 7 64bits with Studio One running as a 32Bit application.

The idea is to instanciate the plugin once after the dll was loaded to extract its factory presets as a set of vstpreset files (using PresetFile) otherwise exposed via a means of a program list parameter. This is done in order to support VST3 presets in cases where the latter API is not supported, e.g. Studio One or Samplitude, but leads to the described crash in Studio one.

It's also worth mentioning that the exception occurs outside of the plugin code and after the plugin has been unloaded in a module linked by Studio One:

The crash happens in cclgui.dll (read access violation at address 0x52C91EA0), which accoding to the description contains Presonus' Cross-platform UI framework.

All other plugins and the code that actually extracts the presets have been removed so it's definitely stripped down to this particular scenario. So far I've only observed this in Studio One.

Arne Scheffler
Posts: 205
Joined: Mon Jun 20, 2016 7:53 am

Re: Is it safe to call GetPluginFactory() in InitModule()?

Postby Arne Scheffler » Mon Jun 25, 2018 8:53 am

Hi,
I think an installer would be the better solution for this use case. The GetPluginFactory method should return as fast as possible.

Cheers,
Arne

ray
Posts: 81
Joined: Fri Sep 02, 2016 9:37 am

Re: Is it safe to call GetPluginFactory() in InitModule()?

Postby ray » Mon Jun 25, 2018 2:26 pm

Arne Scheffler wrote:Hi,
I think an installer would be the better solution for this use case. The GetPluginFactory method should return as fast as possible.

Cheers,
Arne


Hi Arne,

Thanks for getting back so quickly.

I see, however, the extraction step is only performed upon the first instanciation and the code under consideration is called in the InitModule() function, not GetPluginFactory(). So it really only happens once when the plugin is loaded for the first time and the time consuming step is skipped if the preset folder is already present. There is also another requirement for some plugins that are deployed via a distribution partner's installer infrastructure in which plugins are (at least more or less) required to be self contained.

EDIT: Nevermind, I managed to find a workaround that's stable. It seems that the mentioned dll doesn't like COM to be uninitialized twice :). In other words, the reported crash was just a side effect of an unbalanced CoInitialize()/CoUninitialize() sequence. I assume the answer to my initial question is yes.


Return to “VST 3 SDK”

Who is online

Users browsing this forum: No registered users and 2 guests