From 6b5be8d9effe3e416b2e6623e56d3054d19df74f Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 3 May 2017 11:05:56 +0100 Subject: [PATCH] Tweaked the OSX broadcast notification flags to avoid problems with anotherInstanceStarted() --- modules/juce_events/native/juce_mac_MessageManager.mm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/juce_events/native/juce_mac_MessageManager.mm b/modules/juce_events/native/juce_mac_MessageManager.mm index 0ee82d81fb..95e9a59dcc 100644 --- a/modules/juce_events/native/juce_mac_MessageManager.mm +++ b/modules/juce_events/native/juce_mac_MessageManager.mm @@ -52,7 +52,8 @@ public: [[NSDistributedNotificationCenter defaultCenter] addObserver: delegate selector: @selector (broadcastMessageCallback:) name: getBroadcastEventName() - object: nil]; + object: nil + suspensionBehavior: NSNotificationSuspensionBehaviorDeliverImmediately]; } else { @@ -126,7 +127,7 @@ private: static NSApplicationTerminateReply applicationShouldTerminate (id /*self*/, SEL, NSApplication*) { - if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) + if (auto* app = JUCEApplicationBase::getInstance()) { app->systemRequestedQuit(); @@ -144,7 +145,7 @@ private: static BOOL application_openFile (id /*self*/, SEL, NSApplication*, NSString* filename) { - if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) + if (auto* app = JUCEApplicationBase::getInstance()) { app->anotherInstanceStarted (quotedIfContainsSpaces (filename)); return YES; @@ -155,7 +156,7 @@ private: static void application_openFiles (id /*self*/, SEL, NSApplication*, NSArray* filenames) { - if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) + if (auto* app = JUCEApplicationBase::getInstance()) { StringArray files; @@ -200,7 +201,7 @@ private: static void getUrl_withReplyEvent (id /*self*/, SEL, NSAppleEventDescriptor* event, NSAppleEventDescriptor*) { - if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) + if (auto* app = JUCEApplicationBase::getInstance()) app->anotherInstanceStarted (quotedIfContainsSpaces ([[event paramDescriptorForKeyword: keyDirectObject] stringValue])); }