Fix crash on exit
NasalModelDataProxy destructor relies on globals being valid.
This commit is contained in:
parent
ccf674e189
commit
e6c2e258b5
1 changed files with 7 additions and 5 deletions
|
@ -181,12 +181,14 @@ FGNasalModelData* FGNasalModelData::getByModuleId(unsigned int id)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
FGNasalModelDataProxy::~FGNasalModelDataProxy()
|
FGNasalModelDataProxy::~FGNasalModelDataProxy()
|
||||||
{
|
{
|
||||||
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
if (globals) {
|
||||||
|
auto nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||||
|
|
||||||
// when necessary, register Nasal module to be destroyed/unloaded
|
// when necessary, register Nasal module to be destroyed/unloaded
|
||||||
// in the main thread.
|
// in the main thread.
|
||||||
if ((_data.valid())&&(nasalSys))
|
if ((_data.valid())&&(nasalSys))
|
||||||
nasalSys->registerToUnload(_data);
|
nasalSys->registerToUnload(_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue