1
0
Fork 0

Fix crash on exit

NasalModelDataProxy destructor relies on globals being valid.
This commit is contained in:
Stuart Buchanan 2022-11-27 14:29:11 +00:00
parent ccf674e189
commit e6c2e258b5

View file

@ -181,12 +181,14 @@ FGNasalModelData* FGNasalModelData::getByModuleId(unsigned int id)
//------------------------------------------------------------------------------
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
// in the main thread.
if ((_data.valid())&&(nasalSys))
nasalSys->registerToUnload(_data);
// when necessary, register Nasal module to be destroyed/unloaded
// in the main thread.
if ((_data.valid())&&(nasalSys))
nasalSys->registerToUnload(_data);
}
}
//------------------------------------------------------------------------------