Close button not working


Hello… I’m using the demo application from the Juce tutorial in my tests, but when I click the close button through my laptop’s touchpad, the main window do not close.

The following function is declared in my main dialog window:

	void closeButtonPressed ()

Why this doesn’t work? I’ve just tested closing with a mouse device and it didn’t work too.


It works just fine in all my apps! I assume you’ve tried catching it in the debugger to see what’s happening, so does the callback get triggered, and if so, what happens during the quit call?


Thanks for the answer, Jules. My debug project now is crashing so I’m debugging with the release version.

I placed this code to test the closeButtonPressed() functioning:

	void closeButtonPressed ()
		AlertWindow::showNativeDialogBox  ( T("Debug"),T("close button was pressed"),false);

The conclusion is that when I close the application through a ALT+F4, the alert window is shown and the app closes, but when I try to close it through my touchpad or mouse, closeButtonPressed() is never called.


On Juce demo application, the close button closes the application successfully. Maybe it’s a issue from the Juce tutorial application. Maybe something in the Juce library has changed since the last tutorial’s update.


That sounds likely. But like I’ve been saying to other people recently, aren’t you using a debugger? If you were, there should be an assertion if you try closing a window without having implemented a handler for it.


If I were you, I’d be looking into this first.

It may well be that whatever you are doing that is causing the debug build to crash, is silently exploding something in the release build, and you’re only seeing symptoms much much later (ie when trying to close the app).