Quiting Juce-applications

Hello everybody…

I’ve joined a project that uses Juce heavily. In one application, there is an odd problem. Sometimes, quitting the program by command-Q (Mac), the program crashes - but quiting by pressing ESC causes no crash. We use Juce version 1.21.

I won’t post any code, because the project is huge, and the reason I ask, is because I haven’t pin-pointed any bugs yet. Maybe there is a problem with this specific distribution of Juce…?

-Thanks in advance!

-A

You’re probably just doing something daft like deleting your main window twice - have a look at the way the demo app or the jucer handles quitting. Surely it’s obvious what’s going wrong from debugging the crash?

  • Maybe it IS obvious… This is an extract from my call stack:

void JUCE_API shutdownJuce_GUI()
{
if (juceInitialisedGUI)
{
DeletedAtShutdown::deleteAll();

    // doh! you should clear up all your components before exiting!

–> jassert (NativeDesktopWindow::getNumDesktopWindows() == 0);

    LookAndFeel::clearDefaultLookAndFeel();
    shutdownJuce_NonGUI();

    juceInitialisedGUI = false;
}

}

Everything goes tits up at the “–>”. When it says “you should clear…” in the comment, does “you” refer to ME (the user) or the programmer of Juce?

-Thanks,

-A

That’s an assertion, not a crash! And it’s you that it’s referring to - it’s warning you that you’ve quit without deleting one of your top-level windows, so have probably got a memory leak. (Maybe I’ll rephrase the warning to make it a bit clearer!)

(In fact, I notice that I’ve moved the assertion to a different place since the version you’re using)

Toplevel-window, eh… Well, that gets me a bit closer to the error :slight_smile:

  • I’m still curius about your thoughts on the difference between pressing ESC and closing by cmd-Q? The ‘x’ on the window frame works fine like ESC.

Anywho, thanks for your help so far.

-Andreas

[quote=“amygdala”]Toplevel-window, eh… Well, that gets me a bit closer to the error :slight_smile:

  • I’m still curius about your thoughts on the difference between pressing ESC and closing by cmd-Q? The ‘x’ on the window frame works fine like ESC.

Anywho, thanks for your help so far.

-Andreas[/quote]

well escape closes just that one window; quit closes the whole application…