diff --git a/build/macosx/platform_specific_code/juce_mac_MessageManager.mm b/build/macosx/platform_specific_code/juce_mac_MessageManager.mm index bda0adef73..b6dc7f475a 100644 --- a/build/macosx/platform_specific_code/juce_mac_MessageManager.mm +++ b/build/macosx/platform_specific_code/juce_mac_MessageManager.mm @@ -403,11 +403,10 @@ void MessageManager::doPlatformSpecificShutdown() // Annoyingly, cancelPerformSelectorsWithTarget can't actually cancel the messages // sent by performSelectorOnMainThread, so need to manually flush these before quitting.. - for (int i = 100; --i >= 0 && numPendingMessages > 0;) - { - flushingMessages = true; - getInstance()->runDispatchLoopUntil (10); - } + flushingMessages = true; + if (JUCEApplication::getInstance() != 0) // (must avoid blocking here when running as a plugin) + for (int i = 100; --i >= 0 && numPendingMessages > 0;) + getInstance()->runDispatchLoopUntil (10); [juceAppDelegate release]; juceAppDelegate = 0; diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index a7e38f1cdd..098b84fcf1 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -272543,11 +272543,10 @@ void MessageManager::doPlatformSpecificShutdown() // Annoyingly, cancelPerformSelectorsWithTarget can't actually cancel the messages // sent by performSelectorOnMainThread, so need to manually flush these before quitting.. - for (int i = 100; --i >= 0 && numPendingMessages > 0;) - { - flushingMessages = true; - getInstance()->runDispatchLoopUntil (10); - } + flushingMessages = true; + if (JUCEApplication::getInstance() != 0) // (must avoid blocking here when running as a plugin) + for (int i = 100; --i >= 0 && numPendingMessages > 0;) + getInstance()->runDispatchLoopUntil (10); [juceAppDelegate release]; juceAppDelegate = 0;