X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FMain%2Futil.cxx;h=3daeb991b712c4696cb481b59bc14dc958a73339;hb=56d8181da3907eb159a591903c216fdce96fcb81;hp=2a62521d4ae8d47974301d8655f765d0560a5358;hpb=14fe03ba6fd65efdf3283fd692fe6347af722934;p=flightgear.git diff --git a/src/Main/util.cxx b/src/Main/util.cxx index 2a62521d4..3daeb991b 100644 --- a/src/Main/util.cxx +++ b/src/Main/util.cxx @@ -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); }