Frederic Bouvier wrote:

> Jonathan Polley wrote:
>
> > Fred,
> >
> >       It turns out that the problem should exist on every FlightGear
> > system, not just the Mac.  On exit(), fgExitCleanup() is called which
> > deletes the globals class and then calls fgOSExit().  The only thing
> > that fgOSExit() does is turn around and call exit(), which repeats the
> > process.  I changed fgExitCleanup() in main.cxx to be as follows:
> >
> > void fgExitCleanup() {
> >      delete globals;
> >      //fgOSExit(0);
> > }
> >
> > This prevented the recursive call to exit(), but will not work if
> > someone is using the fg_os_sld.cxx module, but it works for me.
>
> I was suspecting that but was not able to reproduce this behavior on
> windows.
>
> What about this instead :
>
> void fgExitCleanup() {
>     if ( globals ) {
>         delete globals;
>         globals = 0;
>         fgOSExit(0);
>     }
> }
>
> It will allow to call the function twice safely. Can you test that.

And what about this that might be better.
-Fred

--- main.cxx 15 Jul 2004 18:07:03 -0000 1.170
+++ main.cxx 18 Jul 2004 12:38:52 -0000
@@ -1495,7 +1495,6 @@
 // which happens in the sound manager destructor.
 void fgExitCleanup() {
     delete globals;
-    fgOSExit(0);
 }


--- util.cxx 16 Mar 2004 20:19:08 -0000 1.7
+++ util.cxx 18 Jul 2004 12:35:38 -0000
@@ -27,6 +27,7 @@

 #include <simgear/debug/logstream.hxx>

+#include "fg_os.hxx"
 #include "fg_io.hxx"
 #include "fg_props.hxx"
 #include "globals.hxx"
@@ -107,7 +108,7 @@
     SG_LOG(SG_GENERAL, SG_INFO, "Exiting FlightGear with status " <<
status);

     globals->get_io()->shutdown_all();
-    exit(status);
+    fgOSExit(status);
 }





_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to