Fix for reset crash:
https://sourceforge.net/p/flightgear/codetickets/2217/ This requires a matching Simgear change, but ensure all places tolerate Nasal subsystem being gone, since this occurs during reset.
This commit is contained in:
parent
858fc6ea01
commit
381919451d
2 changed files with 9 additions and 6 deletions
|
@ -86,7 +86,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||||
if (!nasalSys)
|
if (!nasalSys) // happens during shutdown / reset
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string moduleName = "scenario_" + _internalName;
|
std::string moduleName = "scenario_" + _internalName;
|
||||||
|
|
|
@ -96,15 +96,15 @@ public:
|
||||||
func(f),
|
func(f),
|
||||||
object(obj)
|
object(obj)
|
||||||
{
|
{
|
||||||
FGNasalSys* sys = static_cast<FGNasalSys*>(globals->get_subsystem("nasal"));
|
FGNasalSys* sys = globals->get_subsystem<FGNasalSys>();
|
||||||
_gcKeys[0] = sys->gcSave(f);
|
_gcKeys[0] = sys->gcSave(f);
|
||||||
_gcKeys[1] = sys->gcSave(obj);
|
_gcKeys[1] = sys->gcSave(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void onFileDialogDone(FGFileDialog* instance, const SGPath& aPath)
|
void onFileDialogDone(FGFileDialog* instance, const SGPath& aPath) override
|
||||||
{
|
{
|
||||||
FGNasalSys* sys = static_cast<FGNasalSys*>(globals->get_subsystem("nasal"));
|
FGNasalSys* sys = globals->get_subsystem<FGNasalSys>();
|
||||||
|
|
||||||
naContext ctx = naNewContext();
|
naContext ctx = naNewContext();
|
||||||
naRef args[1];
|
naRef args[1];
|
||||||
args[0] = nasal::to_nasal(ctx, aPath);
|
args[0] = nasal::to_nasal(ctx, aPath);
|
||||||
|
@ -115,7 +115,10 @@ public:
|
||||||
|
|
||||||
~NasalCallback()
|
~NasalCallback()
|
||||||
{
|
{
|
||||||
FGNasalSys* sys = static_cast<FGNasalSys*>(globals->get_subsystem("nasal"));
|
FGNasalSys* sys = globals->get_subsystem<FGNasalSys>();
|
||||||
|
if (!sys) // happens during Nasal shutdown on reset
|
||||||
|
return;
|
||||||
|
|
||||||
sys->gcRelease(_gcKeys[0]);
|
sys->gcRelease(_gcKeys[0]);
|
||||||
sys->gcRelease(_gcKeys[1]);
|
sys->gcRelease(_gcKeys[1]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue