Detect when application crashes
-
I want to know if there is a way to detect or handle application crashes.
For example what if the application is to change some system settings only when it is open and has to change it back to how it was when closing, how to ensure that if the application finishes unexpectedly?
-
Have a separate process that executes the "real" process. If it returns anything other than EXIT_SUCCESS, it crashed, and you can try to handle it as best you can.
-
@wrosecrans said in Detect when application crashes:
Have a separate process that executes the "real" process
Can you elaborate more on that?
-
As wrosecrans suggested you can have two executables, and the second one is watching if the first one is still running.
So the user starts the watcher, there the main process is started (you can use QProcess for that) and when it crashes the watcher can do something.