diff --git a/src/g_demo.c b/src/g_demo.c index 0e359bbd2..91b398981 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -4364,7 +4364,7 @@ boolean G_CheckDemoStatus(void) return true; } - if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING)) + if (demo.recording && (modeattacking || demo.savemode != DSM_NOTSAVING) && (!demo.gamequit)) { G_SaveDemo(); return true; diff --git a/src/g_demo.h b/src/g_demo.h index 65ac075db..3127286fc 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -59,6 +59,7 @@ struct demovars_s { } savemode; boolean freecam; + boolean gamequit; // Game is exiting. const savebuffer_t *buffer; // debug, valid only if recording or playback }; diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 802854937..7e9b6dc50 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -1936,7 +1936,13 @@ void I_Quit(void) // but sometimes we forget and use 'F10'.. so save here too. if (demo.recording) + { + // SIGSEGV #8 is caused by the game still trying to save to an empty pointer. + // Prevent that by doing... this! + demo.gamequit = true; + G_CheckDemoStatus(); + } if (metalrecording) G_StopMetalRecording(false);