From 10baa71a65ae04b8794c1940ae1a284d386331de Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 11 Dec 2002 21:07:30 +0000 Subject: [PATCH] Fix out of order initialization crash (not sure how it worked before unless some recent changes subtlely changed some init order items around.) --- configure.ac | 28 ++++++++++++++-------------- src/Main/fg_props.cxx | 17 +++++++++++------ src/Main/globals.cxx | 36 +++++++++++++++++++++++++++++------- 3 files changed, 54 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index 6c4d2eba6..57451ac45 100644 --- a/configure.ac +++ b/configure.ac @@ -190,6 +190,20 @@ dnl Thread related checks AC_CHECK_LIB(pthread, pthread_exit) AC_CHECK_LIB(socket, socket) +dnl check for glut location +AC_CHECK_HEADER(GL/glut.h) +if test "x$ac_cv_header_GL_glut_h" = "xyes"; then + AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location]) +else + AC_CHECK_HEADER(GLUT/glut.h) + if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then + AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location]) + else + echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue" + exit + fi +fi + dnl check for OpenGL related libraries case "${host}" in *-*-cygwin* | *-*-mingw32*) @@ -266,20 +280,6 @@ case "${host}" in esac -dnl check for glut location -AC_CHECK_HEADER(GL/glut.h) -if test "x$ac_cv_header_GL_glut_h" = "xyes"; then - AC_DEFINE([GLUT_H], "GL/glut.h", [Define as glut.h include location]) -else - AC_CHECK_HEADER(GLUT/glut.h) - if test "x$ac_cv_header_GLUT_glut_h" = "xyes"; then - AC_DEFINE([GLUT_H], "GLUT/glut.h", [Define as glut.h include location]) - else - echo "Neither GL/glut.h nor GLUT/glut.h found. Cannot continue" - exit - fi -fi - opengl_LIBS="$LIBS" LIBS="$base_LIBS" diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index b84688aeb..93c205d1e 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -233,12 +233,17 @@ getFreeze () static void setFreeze (bool f) { - frozen = f; - // Stop sound on a pause - if (f) - globals->get_soundmgr()->pause(); - else - globals->get_soundmgr()->resume(); + frozen = f; + + // Stop sound on a pause + FGSoundMgr *s = globals->get_soundmgr(); + if ( s != NULL ) { + if ( f ) { + s->pause(); + } else { + s->resume(); + } + } } diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index b8341e4c7..ee093bada 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -42,18 +42,40 @@ FGGlobals *globals; // Constructor FGGlobals::FGGlobals() : - subsystem_mgr(new FGSubsystemMgr), - sim_time_sec(0.0), + subsystem_mgr( new FGSubsystemMgr ), + sim_time_sec( 0.0 ), + fg_root( "" ), + fg_scenery( "" ), #if defined(FX) && defined(XMESA) fullscreen( true ), #endif warp( 0 ), warp_delta( 0 ), - props(new SGPropertyNode), - initial_state(0), - locale(NULL), - commands(new SGCommandMgr), - io(new FGIO) + time_params( NULL ), + ephem( NULL ), + mag( NULL ), + autopilot( NULL ), + route( NULL ), + soundmgr( NULL ), + environment_mgr( NULL ), + ATC_mgr( NULL ), + ATC_display( NULL ), + AI_mgr( NULL ), + controls( NULL ), + steam( NULL ), + viewmgr( NULL ), + props( new SGPropertyNode ), + initial_state( NULL ), + locale( NULL ), + commands( new SGCommandMgr ), + model_loader( NULL ), + texture_loader( NULL ), + acmodel( NULL ), + model_mgr( NULL ), + channel_options_list( NULL ), + scenery( NULL ), + tile_mgr( NULL ), + io( new FGIO ) { }