From: curt Date: Mon, 2 Jul 2001 22:11:56 +0000 (+0000) Subject: Updated bug fix to make hopefully more thread safe. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5d2855f1ecd076e3125557d1f199ec05dbd7b368;p=flightgear.git Updated bug fix to make hopefully more thread safe. --- 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;