From 16c83ae2c5cccfd2b9057477806f9694845eafd1 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Wed, 2 Feb 2011 23:57:22 +0000 Subject: [PATCH] Server crash can cause recursive call to Com_Error, too --- code/qcommon/common.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/qcommon/common.c b/code/qcommon/common.c index dff23f99..ca0570a5 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -287,9 +287,9 @@ void QDECL Com_Error( int code, const char *fmt, ... ) { Cvar_Set("com_errorMessage", com_errorMessage); if (code == ERR_DISCONNECT || code == ERR_SERVERDISCONNECT) { + VM_Forced_Unload_Start(); SV_Shutdown( "Server disconnected" ); CL_Disconnect( qtrue ); - VM_Forced_Unload_Start(); CL_FlushMemory( ); VM_Forced_Unload_Done(); // make sure we can get at our local stuff @@ -298,32 +298,36 @@ void QDECL Com_Error( int code, const char *fmt, ... ) { longjmp (abortframe, -1); } else if (code == ERR_DROP) { Com_Printf ("********************\nERROR: %s\n********************\n", com_errorMessage); + VM_Forced_Unload_Start(); SV_Shutdown (va("Server crashed: %s", com_errorMessage)); CL_Disconnect( qtrue ); - VM_Forced_Unload_Start(); CL_FlushMemory( ); VM_Forced_Unload_Done(); FS_PureServerSetLoadedPaks("", ""); com_errorEntered = qfalse; longjmp (abortframe, -1); } else if ( code == ERR_NEED_CD ) { + VM_Forced_Unload_Start(); SV_Shutdown( "Server didn't have CD" ); if ( com_cl_running && com_cl_running->integer ) { CL_Disconnect( qtrue ); - VM_Forced_Unload_Start(); CL_FlushMemory( ); VM_Forced_Unload_Done(); CL_CDDialog(); } else { Com_Printf("Server didn't have CD\n" ); + VM_Forced_Unload_Done(); } + FS_PureServerSetLoadedPaks("", ""); com_errorEntered = qfalse; longjmp (abortframe, -1); } else { + VM_Forced_Unload_Start(); CL_Shutdown (va("Client fatal crashed: %s", com_errorMessage)); SV_Shutdown (va("Server fatal crashed: %s", com_errorMessage)); + VM_Forced_Unload_Done(); } Com_Shutdown ();