From: havoc Date: Mon, 14 Dec 2009 04:13:04 +0000 (+0000) Subject: fix a crash on shutdown when using developer_memory 1 (the conbuffer_t X-Git-Tag: xonotic-v0.1.0preview~1066 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f47d3bbd69de3aab3a8b4f80e5080189e5e380c6;p=xonotic%2Fdarkplaces.git fix a crash on shutdown when using developer_memory 1 (the conbuffer_t is being freed and prints messages while doing so) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9581 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/console.c b/console.c index 2798199b..71a5f869 100644 --- a/console.c +++ b/console.c @@ -92,6 +92,7 @@ char rcon_redirect_buffer[1400]; void ConBuffer_Init(conbuffer_t *buf, int textsize, int maxlines, mempool_t *mempool) { + buf->active = true; buf->textsize = textsize; buf->text = (char *) Mem_Alloc(mempool, textsize); buf->maxlines = maxlines; @@ -117,6 +118,7 @@ ConBuffer_Shutdown */ void ConBuffer_Shutdown(conbuffer_t *buf) { + buf->active = false; Mem_Free(buf->text); Mem_Free(buf->lines); buf->text = NULL; @@ -227,6 +229,10 @@ void ConBuffer_AddLine(conbuffer_t *buf, const char *line, int len, int mask) char *putpos; con_lineinfo_t *p; + // developer_memory 1 during shutdown prints while conbuffer_t is being freed + if (!buf->active) + return; + ConBuffer_FixTimes(buf); if(len >= buf->textsize) diff --git a/console.h b/console.h index 438e9ca2..338690eb 100644 --- a/console.h +++ b/console.h @@ -99,6 +99,7 @@ con_lineinfo_t; typedef struct conbuffer_s { + qboolean active; int textsize; char *text; int maxlines;