From 8d5c27237e9151fec7b3c20f47912c7fbfb0e39b Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 14 Jan 2021 22:02:43 +0000 Subject: [PATCH] MessageManager: Use RAII to simplify app delegate cleanup --- modules/juce_events/native/juce_mac_MessageManager.mm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/juce_events/native/juce_mac_MessageManager.mm b/modules/juce_events/native/juce_mac_MessageManager.mm index 972e894ac7..1cc0b9f8e1 100644 --- a/modules/juce_events/native/juce_mac_MessageManager.mm +++ b/modules/juce_events/native/juce_mac_MessageManager.mm @@ -436,17 +436,16 @@ void initialiseNSApplication() } } -static AppDelegate* appDelegate = nullptr; +static std::unique_ptr appDelegate; void MessageManager::doPlatformSpecificInitialisation() { if (appDelegate == nil) - appDelegate = new AppDelegate(); + appDelegate.reset (new AppDelegate()); } void MessageManager::doPlatformSpecificShutdown() { - delete appDelegate; appDelegate = nullptr; }