diff --git a/Source/UI/DefaultConfig.cpp b/Source/UI/DefaultConfig.cpp index 93d033ad5..5c0811b79 100644 --- a/Source/UI/DefaultConfig.cpp +++ b/Source/UI/DefaultConfig.cpp @@ -63,6 +63,7 @@ void DefaultConfigWindow::launchWindow() auto* window = options.launchAsync(); window->setAlwaysOnTop (true); configWindow = window; + ((DefaultConfigComponent*) window->getContentComponent())->configWindow = window; } //----------------------------------------------------------------------- @@ -239,15 +240,15 @@ void DefaultConfigComponent::buttonClicked (Button* button) #endif // Hide the config window - if (DialogWindow* dw = this->findParentComponentOfClass()) - dw->setVisible (false); + if (configWindow != nullptr) + configWindow->setVisible (false); // Load the config file AccessClass::getUIComponent()->getEditorViewport()->loadState (configFile); // Close config window after loading the config file - if (DialogWindow* dw = this->findParentComponentOfClass()) - dw->exitModalState (0); + if (configWindow != nullptr) + configWindow->exitModalState (0); } else if (button->getRadioGroupId() == 101) { diff --git a/Source/UI/DefaultConfig.h b/Source/UI/DefaultConfig.h index 591805c76..7ed209015 100644 --- a/Source/UI/DefaultConfig.h +++ b/Source/UI/DefaultConfig.h @@ -53,6 +53,8 @@ class DefaultConfigComponent : public Component, /** Responds to button clicks*/ void buttonClicked (Button*) override; + WeakReference configWindow; + private: std::unique_ptr