(macOS 12.0.1)
I created console application (cmake → juce_add_console_app)
I scan plugins in the main thread.
Many of the plugins I scan successfully.
But when I start to scan Lindell Audio 50 Series my application crashes without any exception. Even if I surround pluginDirectoryScanner.scanNextFile
with try-catch, it does not reach catch block.
I have debugged juce code to fine out where exactly it crashes, and found that it happens in loadFrom
method on factory->createInstance
.
line 480 in file juce_VST3Common.h
bool loadFrom (Steinberg::IPluginFactory* factory, const Steinberg::TUID& uuid)
{
jassert (factory != nullptr);
*this = nullptr;
return factory->createInstance (uuid, ObjectType::iid, (void**) &source) == Steinberg::kResultOk;
}
And here is my code, just in case:
PluginScanner::PluginScanner(){
_init();
_scan();
}
PluginScanner::~PluginScanner(){}
void PluginScanner::_save(){}
void PluginScanner::_load(){}
void PluginScanner::_init(){
String workingPath = File::getCurrentWorkingDirectory().getFullPathName();
plugins_file.reset(new File(workingPath + "/" + PLUGIN_DATA_FILE));
if (!plugins_file->exists())
{
plugins_file->create();
}
}
void PluginScanner::_scan(){
FileSearchPath searchPath (VST3_PLUGINPATH);
PluginDirectoryScanner pluginDirectoryScanner (knownPluginList,
pluginFormat,
searchPath,
false /*is reccursive*/,
File(),
false /*is asyncronous*/);
String plugname;
int index = 0;
while (true)
{
String nextname = pluginDirectoryScanner.getNextPluginFileThatWillBeScanned();
std::cout << "scanning " << nextname << std::endl;
// here I just catch a breakpoint when I found the plugin
if (nextname == "/Library/Audio/Plug-Ins/VST3/Lindell 50 Channel.vst3")
{
auto a = 0;
}
try {
// at this point the application silently crashes without any exception
if (pluginDirectoryScanner.scanNextFile(true, plugname)==false)
{
std::cout << "stopped at " << plugname << std::endl;
break;
}
}
catch(std::exception &e){
// and we never go here after silent crash.
std::cout << "failed: " << e.what() << " " << nextname << std::endl;
}
}
plugins_file->appendText(knownPluginList.createXml()->toString());
}
int main(){
PluginScanner();
return 0;
}
Please help!