From: Rudolf Polzer Date: Sun, 6 Apr 2025 20:52:23 +0000 (-0400) Subject: When Host_Error is called during QC init, Sys_Error a bit later. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;p=xonotic%2Fdarkplaces.git When Host_Error is called during QC init, Sys_Error a bit later. This way, we still get packed dump, client error cleanup and - most importantly - a QC backtrace message of where the crash came from. Very useful for debugging. --- diff --git a/host.c b/host.c index f004bb19..031841c0 100644 --- a/host.c +++ b/host.c @@ -103,11 +103,7 @@ void Host_Error (const char *error, ...) Con_Printf(CON_ERROR "Host_Error: %s\n", hosterrorstring1); - // LadyHavoc: if crashing very early, or currently shutting down, do - // Sys_Error instead - if (host.framecount < 1 || host.state != host_active) - Sys_Error ("Host_Error during %s: %s", host_state_str[host.state], hosterrorstring1); - + // "double fault": redirect to Sys_Error. if (hosterror) Sys_Error ("Host_Error: recursively entered (original error was: %s new error is: %s)", hosterrorstring2, hosterrorstring1); hosterror = true; @@ -123,6 +119,11 @@ void Host_Error (const char *error, ...) if(host.hook.SV_Shutdown) host.hook.SV_Shutdown(); + // LadyHavoc: if crashing very early, or currently shutting down, do + // Sys_Error instead and exit the engine fully + if (host.framecount < 1 || host.state != host_active) + Sys_Error ("Host_Error during %s: %s", host_state_str[host.state], hosterrorstring1); + if (cls.state == ca_dedicated) Sys_Error("Host_Error: %s", hosterrorstring1); // dedicated servers exit