Perhaps considered an edge case… but if you try and Command+Q while the saveIfNeededAndUserAgrees() AlertWindow is open you get an assertion.
By having a private MainHostWindow member variable
bool tryingToCloseFlag;
intialized to false, then in
bool MainHostWindow::tryToQuitApplication()
{
if (tryingToCloseFlag)
return false;
PluginWindow::closeAllCurrentlyOpenWindows();
tryingToCloseFlag = true;
if (getGraphEditor() == nullptr
|| getGraphEditor()->graph.saveIfNeededAndUserAgrees() == FileBasedDocument::savedOk)
{
JUCEApplication::quit();
return true;
}
tryingToCloseFlag = false;
return false;
}
This will stop the assertion… otherwise the AlertWindows stack up and when you quit() some components are going to leak.
Rail