This could happen, when a trace screen was destroyed and then recreated.
#include "tr_texture.h"
+static boolean close_stream = FALSE;
static FILE *stream = NULL;
static unsigned refcount = 0;
pipe_static_mutex(call_mutex);
{
if(stream) {
trace_dump_writes("</trace>\n");
- fclose(stream);
- stream = NULL;
+ if (close_stream) {
+ fclose(stream);
+ close_stream = FALSE;
+ stream = NULL;
+ }
refcount = 0;
call_no = 0;
}
if(!stream) {
if (strcmp(filename, "stderr") == 0) {
+ close_stream = FALSE;
stream = stderr;
}
else if (strcmp(filename, "stdout") == 0) {
+ close_stream = FALSE;
stream = stdout;
}
else {
+ close_stream = TRUE;
stream = fopen(filename, "wt");
if (!stream)
return FALSE;