Quit and wait until quit


#1

I’m integrating WinSparkle into a JUCE app. The app has to close down a number of threads and internet connections potentially when it exits. And I need that to happen before the installer kicks off really.

So given that I have a call to JUCEApplication::quit() that happens on a non-message thread is there any easy way of blocking that thread until the app is pretty much ready to exit and the other threads are stopped. I can think of some hard ways…


#2

s’ok … I think I have a solution


#3

Yep - solution is:

  • Move the updater classes to Main.cpp from MainComponent.
  • Put a flag that’s set when MainComponent and everything else non-essential is deleted.
  • Block until the flag is set
  • Return from my ‘request quit’ callback to the auto-updater code