]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
When Host_Error is called during QC init, Sys_Error a bit later. master
authorRudolf Polzer <divVerent@gmail.com>
Sun, 6 Apr 2025 20:52:23 +0000 (16:52 -0400)
committerRudolf Polzer <divVerent@gmail.com>
Sun, 6 Apr 2025 20:52:23 +0000 (16:52 -0400)
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.

host.c

diff --git a/host.c b/host.c
index f004bb19eb224614f091420932054bb7fa0f9a16..031841c074839ba95e3b1a3467daf8c0ac6528f0 100644 (file)
--- 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