Howdy
I'm trying to properly shutdown an app based on the standalonefilterwindow.
For the most part, all is well, however a particular problem is when I have the audio settings window open, and quit the app, it triggers this:
// doh! If you don't delete all your windows before exiting, you're going to // be leaking memory! jassert (desktopComponents.size() == 0);
I think I get what is happening here - I'm creating that audio settings window but then not clearing it out properly cause the function that creates it is still running when the application is quit.
What is the best way to close out that audio settings dialog? I'm figuring I will do it in deleteFilter of standalonefilterwindow, but I can't figure out exactly how to do it.
For reference, here is the audio settings creation code:
virtual void showAudioSettingsDialog() { DialogWindow::LaunchOptions o; o.content.setOwned (new AudioDeviceSelectorComponent (*deviceManager, filter->getNumInputChannels(), filter->getNumInputChannels(), filter->getNumOutputChannels(), filter->getNumOutputChannels(), true, true, false, false)); o.content->setSize (500, 450); o.dialogTitle = TRANS("Audio Settings"); o.dialogBackgroundColour = Colours::lightgrey; o.escapeKeyTriggersCloseButton = true; o.useNativeTitleBar = true; o.resizable = false; o.launchAsync(); }
My first guess was to declare DialogWindow::LaunchOptions o; as a private variable of the filterwindow itself - then I could call something like o.content->removeFromDesktop() in the deleteFilter function.
I keep hitting different errors whenever I try things like that, and this is an area of c++ I'm fairly new to. I'm also looking at the OptionalScopePointer part of this (http://www.juce.com/api/structDialogWindow_1_1LaunchOptions.html#afb8d6fb02aec1a20e787de456556067a) - but not quite sure how to implement that.
Thanks for any pointers or areas I could research more on.