Shutdown() not being called

Hi Jules,


I noticed a change of behaviour or recent JUCE builds with respect to JUCEApplication::shutdown()

shutdown() used to be called even when I was calling JUCEApplication::quit() from the JUCEApplication::initialise() function. But it is no more.

It seems to me that the old behaviour was more logical.


This change of behaviour is a consequence of a change to 'JUCEApplicationBase::initialiseApp' (previously JUCEApplication::initialiseApp) which is now returning 'false' when it detects that a quit() message has been posted.

For the record, the fix to revert to the old (better) behaviour is to replace return false with return true here:

--- a/juce/modules/juce_events/messages/juce_ApplicationBase.cpp        Fri Apr 03 14:41:41 2015 +0200
+++ b/juce/modules/juce_events/messages/juce_ApplicationBase.cpp        Wed Apr 08 12:53:37 2015 +0200
@@ -262,8 +262,10 @@

     stillInitialising = false;

     if (MessageManager::getInstance()->hasStopMessageBeenSent())
-        return false;
+        return true;

     if (multipleInstanceHandler != nullptr)

I can't decide what the best answer is to this.. I vaguely remember that there were problems if the message loop was allowed to run when the initialise() method aborted during startup. Maybe it was in command-line or mobile apps that this was an issue.. can't remember the exact details though.

Perhaps a better fix would be to leave it returning false, but to make sure that in the code-paths which call it, they always do call shutdownApp() before they quit?

Yes , that sounds good !

Should be doing this now - give it a shot..

Works fine !