Strange crash on first load of new plugin build

Hi Folks,

Wonder if anyone can help me out. I’m helping someone out with a bit of plugin code as they were unsure how to handle buffer writes in JUCE in comparison to the VST SDK approach etc.

The code is all sorted, however, I’m running into an issue in which the very first load of a fresh build crashes the PluginHost app. So if I scan for new vst’s and load the newly built version (after clearing the list of available plugins) I’m finding that the PluginHost crashes with the plugin in question as soon as I move focus from PluginHost to another app.

Yet if I then close PluginHost down and open again, reload the plugin (without scanning but still the same build) the crash does not occur.

It appears to be some issue on the message thread but I cannot work out where in the code it’s being caused.

Heres a stack trace at the point of the crash:

Plugin Host.exe!juce::MessageManager::dispatchNextMessageOnSystemQueue(bool returnIfNoPendingMessages) Line 118 C++

Plugin Host.exe!juce::MessageManager::runDispatchLoop() Line 130 C++

Plugin Host.exe!juce::JUCEApplicationBase::main() Line 244 C++

Plugin Host.exe!WinMain(HINSTANCE__ * formal, HINSTANCE * __formal, char * __formal, int __formal) Line 133 C++

Running on Windows 10 using the current master branch.

The exception thrown is an Access violation. Sorry I’m used to working in Linux but have quickly debugged this in VS on a work machine and haven’t a whole lot of experience using the debugger for cpp.

Any words of wisdom much appreciated.

Cheers

One difference between first time and second time is, that the host might call setStateInformation. I would focus on that. E.G. does the crash still happen, if you comment the content of setStateInformation out?

Hey daniel,

Just gave that a go and sadly still crashing out.

Cheers for the tip though

Ignore this one

If it realy happen only if you scan the Plugin, focus you eyes on the PluginProcessor code. Something is wrong there. Sounds a little bit like a thread waits for the Editor || User input || Licence check and run after that in a nullptr. Maybe something like this is in your code?

Check that everything what you create in your constructor get destroyed in the destructor from the Processor, and have a look for a thread.

That’s exactly what I’m assuming. Some sort of wait on the message thread.

Can’t work out where yet for the life of me. No dodgy memory allocation anywhere as far as I can tell at the moment.

Most likely being thick.

Edit: Hmmm VST3 Builds seem happy…have I missed something

Seems like the same error from the following thread …

I have no idea.

Maybe time to get down and debug the host properly.

Same thing occurs loading VST2 version of the plugin demo.

Wait… you get a crash when you load the VST2 version of the JUCE plugin demo within the JUCE plugin host (both compiled on latest master?)? That would be very strange as we test this nearly daily. Do you have a stack trace of this?

Hey Fabian.

I’m not at that machine at the moment but I’ll pull the master again tonight and build fresh for the demo and host under VST2 and 3 as a sanity check and get back to you.

Josh