]> git.mxchange.org Git - flightgear.git/commitdiff
remove the "ai_model" subsystem manually before the other subsystems
authormfranz <mfranz>
Sun, 11 Jun 2006 15:18:48 +0000 (15:18 +0000)
committermfranz <mfranz>
Sun, 11 Jun 2006 15:18:48 +0000 (15:18 +0000)
are taken down by the C++ runtime environment. This will later be done
with runlevels. Why would we want to run nasal code in subsystem
destructors? We don't really. But some data structures may use nasal,
which are normally created/destroyed during runtime. And these will
also be destroyed at fgfs exit. In the past things like these didn't
happen, because someone had disabled all subsystem destructors ...

src/Main/util.cxx

index 2a62521d4ae8d47974301d8655f765d0560a5358..3daeb991b712c4696cb481b59bc14dc958a73339 100644 (file)
@@ -104,8 +104,13 @@ fgSetupWind (double min_hdg, double max_hdg, double speed, double gust)
 void
 fgExit (int status)
 {
-    SG_LOG(SG_GENERAL, SG_INFO, "Exiting FlightGear with status " << status);
+    // remove subsystems first, which need access to other subsystems in their
+    // destructors (e.g. "nasal")
+    SGSubsystem *sub = globals->get_subsystem("ai_model");
+    globals->get_subsystem_mgr()->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("ai_model");
+    delete sub;
 
+    SG_LOG(SG_GENERAL, SG_INFO, "Exiting FlightGear with status " << status);
     exit(status);
 }