[Orxonox-commit 5551] r10214 - in code/branches/presentationFS14/src/orxonox: items worldentities/pawns
landauf at orxonox.net
landauf at orxonox.net
Sat Jan 31 16:54:16 CET 2015
Author: landauf
Date: 2015-01-31 16:54:16 +0100 (Sat, 31 Jan 2015)
New Revision: 10214
Modified:
code/branches/presentationFS14/src/orxonox/items/PartDestructionEvent.cc
code/branches/presentationFS14/src/orxonox/worldentities/pawns/SpaceShip.cc
Log:
fixed segfault. after removing the engine from the ship, we need to destroy it. otherwise the engine remains in the object lists and will be destroyed at the end of the game - but at this point the ship may not exist anymore, leading to a crash.
Modified: code/branches/presentationFS14/src/orxonox/items/PartDestructionEvent.cc
===================================================================
--- code/branches/presentationFS14/src/orxonox/items/PartDestructionEvent.cc 2015-01-31 15:21:49 UTC (rev 10213)
+++ code/branches/presentationFS14/src/orxonox/items/PartDestructionEvent.cc 2015-01-31 15:54:16 UTC (rev 10214)
@@ -120,7 +120,7 @@
{
switch (this->targetParam_) {
case null:
- this->parent_->getParent()->removeEngine(this->parent_->getParent()->getEngineByName(targetName_));
+ this->parent_->getParent()->getEngineByName(targetName_)->destroy();
break;
case boostfactor:
this->parent_->getParent()->getEngineByName(targetName_)->setBoostFactor(operate(this->parent_->getParent()->getEngineByName(targetName_)->getBoostFactor()));
Modified: code/branches/presentationFS14/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/presentationFS14/src/orxonox/worldentities/pawns/SpaceShip.cc 2015-01-31 15:21:49 UTC (rev 10213)
+++ code/branches/presentationFS14/src/orxonox/worldentities/pawns/SpaceShip.cc 2015-01-31 15:54:16 UTC (rev 10214)
@@ -372,6 +372,8 @@
Remove a particular Engine from the SpaceShip.
@param engine
A pointer to the Engine to be removed.
+ @note
+ Don't forget to reset the Engine's ship pointer after it was removed (or destroy the engine).
*/
void SpaceShip::removeEngine(Engine* engine)
{
More information about the Orxonox-commit
mailing list