Skip to content

Commit

Permalink
[Bugfix] Fixes segfaults on program shutdown
Browse files Browse the repository at this point in the history
Fixes: #916

Also fixes a similar crash when removing the 767 Airline (http://www.rigsofrods.org/old-forum/forums/118-Flying-machines/52648/page-0001.html) before shutting RoR down
  • Loading branch information
ulteq committed May 14, 2016
1 parent 0052082 commit 1d49170
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
12 changes: 2 additions & 10 deletions source/main/physics/air/AirBrake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,8 @@ Airbrake::~Airbrake()
{
if (!msh.isNull()) msh->unload();

if (ec)
{
ec->setVisible(false);
delete ec;
}
if (snode)
{
snode->setVisible(false);
delete snode;
}
if (ec) ec->setVisible(false);
if (snode) snode->setVisible(false);
}

void Airbrake::updatePosition(float amount)
Expand Down
10 changes: 0 additions & 10 deletions source/main/physics/air/TurboJet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,15 @@ Turbojet::~Turbojet()
SoundScriptManager::getSingleton().trigStop(trucknum, ab_id);
SoundScriptManager::getSingleton().trigStop(trucknum, src_id);

if (heathazePS != nullptr) delete heathazePS;
if (smokePS != nullptr) delete smokePS;

if (smokeNode != nullptr) delete smokeNode;

if (flameMesh != nullptr)
{
flameMesh->setVisible(false);
delete flameMesh;
}

if (nozzleMesh != nullptr)
{
nozzleMesh->setVisible(false);
delete nozzleMesh;
}

if (absnode != nullptr) delete absnode;
if (nzsnode != nullptr) delete nzsnode;
}

void Turbojet::updateVisuals()
Expand Down
15 changes: 5 additions & 10 deletions source/main/physics/air/TurboProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,26 +155,21 @@ Turboprop::~Turboprop()
SoundScriptManager::getSingleton().modulate(trucknum, mod_id, 0);
SoundScriptManager::getSingleton().trigStop(trucknum, src_id);

if (heathazePS != nullptr) delete heathazePS;
if (smokePS != nullptr) delete smokePS;
if (smokeNode != nullptr) delete smokeNode;
if (airfoil != nullptr) delete airfoil;
if (airfoil != nullptr) delete airfoil;
}

void Turboprop::updateVisuals()
{
//visuals
if (rpm>200)
{
int i;
for (i=0; i<free_vpale; i++) vpales[i]->setVisible(false);
vspinner->setVisible(true);
for (int i=0; i<free_vpale; i++) vpales[i]->setVisible(false);
if (vspinner) vspinner->setVisible(true);
}
else
{
int i;
for (i=0; i<free_vpale; i++) vpales[i]->setVisible(true);
vspinner->setVisible(false);
for (int i=0; i<free_vpale; i++) vpales[i]->setVisible(true);
if (vspinner) vspinner->setVisible(false);
}
//smoke
if (smokeNode)
Expand Down

0 comments on commit 1d49170

Please sign in to comment.