1
0
Fork 0

Reset, fix Nasal timers added on shutdown.

This commit is contained in:
James Turner 2014-01-13 16:41:31 +00:00
parent 4d0eeb8184
commit 061154d7a6
3 changed files with 25 additions and 0 deletions

View file

@ -85,6 +85,9 @@ public:
}
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(),

View file

@ -948,6 +948,13 @@ void fgStartNewReset()
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();

View file

@ -544,6 +544,18 @@ static void treeDumpRefCounts(int depth, SGPropertyNode* nd)
}
}
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()
{
@ -564,6 +576,9 @@ 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);