Proper Way To Close a multi-window app on Windows

Hello All,

 

I am still pretty new to Juce, but I am just starting to nuild a multi-window app, & when using the closeButtonPressed function in both windows to exit out of the app:


    void closeButtonPressed() override
    {
        JUCEApplication::getInstance()->systemRequestedQuit();
    }

I am getting a breakpoint thrown from the LeakedObjectDetector, which I think is because it is trying to delete a pointer to a window which was already deleted? When I have one window, the close works fine, or if one window has the closeButtonPress function, & the other doesn't the close works fine too. 

 

I was wondering if anyone has a good method for closing multi-window apps, of if there is a bettor method?

Maybe have a look at how the Introjucer handles this?

Thanks Julian, 

 

but the error we are running into is because we have two windows with two openGL contexts running -- The object that is trying to be deleted is juce::OpenGLRendering::ShaderPrograms. Also, the crash only seems to be happening on windows, & not on osx.