I'd like our application to have a special window that catches crashes. Such window would have the ability to electronically send us the stack trace (on Mac), or the .dmp files on windows.
I can handle the window and its internal functionality -- but how does one catch an application crash in time to gracefully display a custom window?
I'm with Qt 4.8.5
First - with crash I understand things like access violation, division by 0 etc., not exceptions that you throw yourself - these can be handled with implementing QApplication::notify
. If you need platform independent solution then i guess you would have to make a wrapper for the functionality on each platform:
On Windows I guess you could wrap everything with
__try { ... } __except { ... }
Maybe you can subclass the QApplication and in your class actually handle the signal handler installation / add try-except handlers (depending on the platform) and then call some generic method where you do all setup and begin the event loop. That is just my two cents.
Working with Qt 4 years ago, I was in need of the same functionality.
Don't reinvent the wheel. I used Crashrpt with success. Comes with much needed features for user support.
https://code.google.com/p/crashrpt/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With