Browse Source

Added a workaround to the host demo app to avoid subtle event-loop problems with certain plugins on OSX.

tags/2021-05-28
jules 9 years ago
parent
commit
db152f618b
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      examples/audio plugin host/Source/HostStartup.cpp

+ 15
- 1
examples/audio plugin host/Source/HostStartup.cpp View File

@@ -32,7 +32,8 @@
//============================================================================== //==============================================================================
class PluginHostApp : public JUCEApplication
class PluginHostApp : public JUCEApplication,
private AsyncUpdater
{ {
public: public:
PluginHostApp() {} PluginHostApp() {}
@@ -59,6 +60,19 @@ public:
mainWindow->menuItemsChanged(); mainWindow->menuItemsChanged();
// Important note! We're going to use an async update here so that if we need
// to re-open a file and instantiate some plugins, it will happen AFTER this
// initialisation method has returned.
// On Windows this probably won't make a difference, but on OSX there's a subtle event loop
// issue that can happen if a plugin runs one of those irritating modal dialogs while it's
// being loaded. If that happens inside this method, the OSX event loop seems to be in some
// kind of special "initialisation" mode and things get confused. But if we load the plugin
// later when the normal event loop is running, everything's fine.
triggerAsyncUpdate();
}
void handleAsyncUpdate() override
{
File fileToOpen; File fileToOpen;
for (int i = 0; i < getCommandLineParameterArray().size(); ++i) for (int i = 0; i < getCommandLineParameterArray().size(); ++i)


Loading…
Cancel
Save