Oh god no!! Please don’t try to do that. It’s bad on so many levels!
As a host-writer, plugins that attempt to run a modal loop are just a total facepalm - just imagine the horrible re-entrant stack calls that end up happening… And if a plugin goes re-entrant and is then closed, it’s impossible for the host to unwind the stack without crashing. It’s even impossible to detect it happening!
And now that hosts are starting to run plugins in child processes (or even remote machines!), modality is even more dangerous than it used to be.
What you can do is open a window, and put it into a modal state, but don’t run the modal loop yourself - e.g. use . If in doubt, you might want to set JUCE_MODAL_LOOPS_PERMITTED=0 for your project, which should prevent you doing anything silly.
…but even that will make people hate you! There’s nothing more annoying when scanning for plugins than the ones that pop up their irritating unlock windows every time… People who’ve installed your demo will see your plugin’s name popping up again and again in a nagging way, and will associate it with their annoyance in having to keep dismissing it - it’s not good marketing.
Why not just embed your unlocking window inside your plugin’s GUI? That’d be my approach to this kind of thing.