As suggested by divVerent in chat.
In SDL builds (including when using -dedicated on the cmdline) the OS
handler runs after the user clicks OK on the SDL dialog.
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
oldtime = Sys_DirtyTime();
// Main event loop
- while(host.state != host_shutdown)
+ while(host.state < host_shutdown) // see Sys_HandleCrash() comments
{
// Something bad happened, or the server disconnected
if (setjmp(host.abortframe))
typedef enum host_state_e
{
- host_shutdown,
host_init,
host_loading,
host_active,
+ // states >= host_shutdown cause graceful shutdown, see Sys_HandleCrash() comments
+ host_shutdown,
host_failing, ///< crashing
host_failed ///< crashed or aborted, SDL dialog open
} host_state_t;
Sys_SDL_Dialog("Engine Crash", dialogtext);
fflush(stderr); // not async-signal-safe :(
- _Exit(sig);
+
+ // Continue execution with default signal handling.
+ // A real crash will be re-triggered so the platform can handle it,
+ // a fake crash (kill -SEGV) will cause a graceful shutdown.
+ signal(sig, SIG_DFL);
}
static void Sys_HandleSignal(int sig)