Close button not working


#1

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 ()
	{
		JUCEApplication::quit();
	}

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


#2

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?


#3

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);
		JUCEApplication::quit();
	}

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.


#4

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.


#5

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.


#6

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).


#7