diff --git a/modules/juce_gui_basics/native/juce_android_Windowing.cpp b/modules/juce_gui_basics/native/juce_android_Windowing.cpp index 9fa4733777..369a991bd6 100644 --- a/modules/juce_gui_basics/native/juce_android_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_android_Windowing.cpp @@ -665,7 +665,10 @@ JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, alertDismissed, void, (JNIEn jlong callbackAsLong, jint result)) { if (ModalComponentManager::Callback* callback = (ModalComponentManager::Callback*) callbackAsLong) + { callback->modalStateFinished (result); + delete callback; + } } //============================================================================== diff --git a/modules/juce_gui_basics/native/juce_ios_Windowing.mm b/modules/juce_gui_basics/native/juce_ios_Windowing.mm index 963179d0f4..fe06fbb40d 100644 --- a/modules/juce_gui_basics/native/juce_ios_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_ios_Windowing.mm @@ -154,7 +154,7 @@ private: int result; JuceAlertBoxDelegate* delegate; UIAlertView* alert; - ModalComponentManager::Callback* callback; + ScopedPointer callback; const bool isYesNo, isAsync; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (iOSMessageBox) diff --git a/modules/juce_gui_basics/native/juce_mac_Windowing.mm b/modules/juce_gui_basics/native/juce_mac_Windowing.mm index 3f7afe8bfb..b629729d5a 100644 --- a/modules/juce_gui_basics/native/juce_mac_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_mac_Windowing.mm @@ -67,7 +67,7 @@ public: private: AlertWindow::AlertIconType iconType; String title, message; - ModalComponentManager::Callback* callback; + ScopedPointer callback; const char* button1; const char* button2; const char* button3; diff --git a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp index 5b148cfb69..0542d03e2d 100644 --- a/modules/juce_gui_basics/native/juce_win32_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_win32_Windowing.cpp @@ -2931,14 +2931,12 @@ class WindowsMessageBox : public AsyncUpdater { public: WindowsMessageBox (AlertWindow::AlertIconType iconType, - const String& title_, const String& message_, - Component* associatedComponent, - UINT extraFlags, - ModalComponentManager::Callback* callback_, - const bool runAsync) + const String& boxTitle, const String& m, + Component* associatedComponent, UINT extraFlags, + ModalComponentManager::Callback* cb, const bool runAsync) : flags (extraFlags | getMessageBoxFlags (iconType)), owner (getWindowForMessageBox (associatedComponent)), - title (title_), message (message_), callback (callback_) + title (boxTitle), message (m), callback (cb) { if (runAsync) triggerAsyncUpdate(); @@ -2964,7 +2962,7 @@ private: UINT flags; HWND owner; String title, message; - ModalComponentManager::Callback* callback; + ScopedPointer callback; static UINT getMessageBoxFlags (AlertWindow::AlertIconType iconType) noexcept {