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

gui

#1

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