I want ANY unhandled exception to go through my JUCEApplication::unhandledException() override, not just ones that are thrown in the Ui thread.
Thoughts / Strategy? Do I have to wrap every thread I create with my own class that has this functionality? And how do I pass this exception over to the Ui thread, and kill all other running threads, so I can safely show an exception and shut down?
Under Linux, it’s already the case, an unhandled exception is a signal and it’s sent to all thread.
Under Windows, you can probably modify the createThread native method to wrap it up in “__try / __except” handler.
Under MacOSX, I’ve no idea.
Well what I did was make my own Thread class to wrap a boost::thread (I like the boost interruption model better than the Juce polling model), so every single one of my threads has a try/catch at the uppermost level.
So now my next issue is how do I launch a second instance of my app with command line parameters, in a Juce/cross platform way.
If my app is launched with a command line string, instead of doing what my app normally does I just show an AlertWindow and bail. This gives me a bulletproof way to get an exception dialog up while killing off the original process.
try/catch doesn’t work for non exception (like SIGBUS / SIGPIPE and access violation). You need a per-platform way to catch these anyway, so you’ll need the SEH on windows, and handling the signals on linux (and probably on Mac too)
I’m mainly concerned with regular C++ exceptions since I use them as a sort of assertion that still gets compiled into release builds. I want them to terminate my app because it means that something is wrong and we can’t continue (or else risk corrupting the database).
For SEH yeah I would love to wrap the calls to the VST plugins since the free ones love to blow up my application periodically.