Issues with all the plug-ins loading too slowly and PluginEditor constructor

Hello to the JUCE team ! Hello @jules and @t0m !

I have seen an issue several times in a row in some plug-ins I made recently. When a plug-in does a lot of things in PluginProcessor constructor, taking some time before everything is properly initialised, sometimes the UI appears but is empty. I did an assertion to see what is going on, and apparently the function PluginEditor::resized() is called with the width and the height of the UI being zero. It happens for example in Reaper 64 bits / Windows 8.1.

So I’ve just done a quick test. I have created a new VST2 plug-in with the Projucer, and I add only one line of code in PluginProcessor constructor, which is:

Thread::sleep(20000);

Then, I compile the plug-in in Debug configuration, I open it in Reaper, and I get that very specific issue, the loading waits for 20 seconds and then no UI because the size of the window is 0x0 ! And if I double click on the plug-in to reload the PluginEditor constructor, the window appears and the UI is working properly.

I have always assumed that the PluginEditor constructor is always called after the PluginProcessor constructor has been completed, and that it’s totally fine if the process is long but it seems that’s not the case.

Any idea about what is happening there ? Am I missing something ?

Thanks in advance !
Ivan

2 Likes

I have the same problem if there is something like an app loading during the plug-in startup and slowing down the process…

Any information about this ?

1 Like

I would be very curious, which threads are doing what in Reaper.
Did you try to give each plugin instance a public uuid and add

DBG ("Finished constructor " << processor.uuid 
  << " on thread " << Thread::getCurrentThread()->getThreadName());

Since creating an editor is a method of the processor, it sounds kludgy to call createEditor() before the processor constructor has finished (is that even possible?).

I tried to do a few tests on that, but I have never been able to figure out what is going on. The only thing I could do is to add a workaround in the PluginEditor resized function, with an attempt to see if the getWidth() returns 0 or not, in which case I call the setSize function again.

I have seen this issue in numerous plug-ins other people released, probably using JUCE, for example if there is the iLok window which shows up before the editor component.