In your original message you wrote that your need is to restart, which can easily be done with QProcess.

Now you write "instead of crashing".

The only way not to crash is not do things that make the program crash.
A crash is program state where the operating system can no longer execute the program, one cannot "recover" from a crash.

Cheers,
_