From 5d2855f1ecd076e3125557d1f199ec05dbd7b368 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 2 Jul 2001 22:11:56 +0000 Subject: [PATCH] Updated bug fix to make hopefully more thread safe. --- src/Cockpit/hud.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Cockpit/hud.cxx b/src/Cockpit/hud.cxx index 06988bf34..257f1fbb2 100644 --- a/src/Cockpit/hud.cxx +++ b/src/Cockpit/hud.cxx @@ -939,8 +939,13 @@ void fgHUDalphaInit( void ) { void fgHUDReshape(void) { if ( HUDtext ) { - delete HUDtext; + // this chunk of code is not necessarily thread safe if the + // compiler optimizer reorders these statements. Note that + // "delete ptr" does not set "ptr = NULL". We have to do that + // ourselves. + fntRenderer *tmp = HUDtext; HUDtext = NULL; + delete tmp; } HUD_TextSize = fgGetInt("/sim/startup/xsize") / 60;