}
FGNasalSys* nasalSys = (FGNasalSys*) globals->get_subsystem("nasal");
+ if (!nasalSys)
+ return;
+
std::string moduleName = "scenario_" + _internalName;
if (!_unloadScript.empty()) {
nasalSys->createModule(moduleName.c_str(), moduleName.c_str(),
fgSetBool("/sim/freeze/master", true);
SGSubsystemMgr* subsystemManger = globals->get_subsystem_mgr();
+ // Nasal is manually inited in fgPostInit, ensure it's already shutdown
+ // before other subsystems, so Nasal listeners don't fire during shutdonw
+ SGSubsystem* nasal = subsystemManger->get_subsystem("nasal");
+ nasal->shutdown();
+ nasal->unbind();
+ subsystemManger->remove("nasal");
+
subsystemManger->shutdown();
subsystemManger->unbind();
}
}
+static void treeClearAliases(SGPropertyNode* nd)
+{
+ if (nd->isAlias()) {
+ nd->unalias();
+ }
+
+ for (int i=0; i<nd->nChildren(); ++i) {
+ SGPropertyNode* cp = nd->getChild(i);
+ treeClearAliases(cp);
+ }
+}
+
void
FGGlobals::resetPropertyRoot()
{
orientHeading.clear();
orientRoll.clear();
+ // clear aliases so ref-counts are accurate when dumped
+ treeClearAliases(props);
+
SG_LOG(SG_GENERAL, SG_INFO, "root props refcount:" << props.getNumRefs());
treeDumpRefCounts(0, props);