From aec8617f59eab574f10a1071bbd320b163acb705 Mon Sep 17 00:00:00 2001 From: reuk Date: Fri, 8 Sep 2023 19:54:14 +0100 Subject: [PATCH] OnlineUnlockForm: Fix scope of AlertWindow so that it outlives the OverlayComp --- .../marketplace/juce_OnlineUnlockForm.cpp | 13 ++++++++----- .../marketplace/juce_OnlineUnlockForm.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.cpp b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.cpp index a8b174523a..ba618d4a8f 100644 --- a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.cpp +++ b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.cpp @@ -102,15 +102,19 @@ struct OnlineUnlockForm::OverlayComp : public Component, { auto options = MessageBoxOptions::makeOptionsOk (MessageBoxIconType::WarningIcon, TRANS ("Registration Failed"), - result.errorMessage); - messageBox = AlertWindow::showScopedAsync (options, nullptr); + result.errorMessage, + {}, + &form); + form.messageBox = AlertWindow::showScopedAsync (options, nullptr); } else if (result.informativeMessage.isNotEmpty()) { auto options = MessageBoxOptions::makeOptionsOk (MessageBoxIconType::InfoIcon, TRANS ("Registration Complete!"), - result.informativeMessage); - messageBox = AlertWindow::showScopedAsync (options, nullptr); + result.informativeMessage, + {}, + &form); + form.messageBox = AlertWindow::showScopedAsync (options, nullptr); } else if (result.urlToLaunch.isNotEmpty()) { @@ -145,7 +149,6 @@ struct OnlineUnlockForm::OverlayComp : public Component, Spinner spinner; OnlineUnlockStatus::UnlockResult result; String email, password; - ScopedMessageBox messageBox; std::unique_ptr cancelButton; diff --git a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.h b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.h index 6b87ca6aeb..5dee8cd324 100644 --- a/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.h +++ b/modules/juce_product_unlocking/marketplace/juce_OnlineUnlockForm.h @@ -87,6 +87,7 @@ private: struct OverlayComp; friend struct OverlayComp; + ScopedMessageBox messageBox; Component::SafePointer unlockingOverlay; void buttonClicked (Button*) override;