In my application, exceptions are fatal (with one special case, boost::thread_interrupted is non-terminal). I use an exception to indicate that the application can no longer continue. I put enough information into the exception to report a fancy string to the user.
What I want to do, is have a bullet-proof way of showing the user an AlertWindow detailing the exception. When this AlertWindow appears, it is necessary to kill the entire application process so that nothing can run and cause re-entrancy, or repeating asserts/exceptions, etc…
Therefore, my solution is to launch a second instance of my application to display the AlertWindow, using command line parameters. This way, I can get the dialog up no matter what, and forcefully terminate the faulty original instance.
Here are the questions:
- How can I use Juce to launch the second instance?
I have to return false moreThanOneInstanceAllowed() in order for the second instance to get into initialise(), but I still don’t want two instances under regular conditions. Therefore, I am going to make a copy of the code in JUCEApplication::initialiseApp() that creates the InterProcessLock, and put the code copy in my initialise() so I can return false from moreThanOneInstanceAllowed() but still prevent multiple normal launches.
Why the" #if ! JUCE_IOS" in JUCEApplication::initialiseApp()?
Does MacOS allow me to launch the second instance, or does MacOS simply not allow the same app to launch twice?
Anything else I should know about?