From 997eb17f9682ba920fe0ea88684a0bbbd61d045a Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Thu, 19 Jun 2014 22:14:06 +0100 Subject: [PATCH] paranoid check in case of recurrence of race described in refs #270 --- src/blackcore/context_simulator_impl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/blackcore/context_simulator_impl.cpp b/src/blackcore/context_simulator_impl.cpp index 658f195d7..69e080899 100644 --- a/src/blackcore/context_simulator_impl.cpp +++ b/src/blackcore/context_simulator_impl.cpp @@ -136,9 +136,13 @@ namespace BlackCore aircraft.setSituation(simulatorAircraft.getSituation()); aircraft.setCockpit(simulatorAircraft.getCom1System(), simulatorAircraft.getCom2System(), simulatorAircraft.getTransponderCode()); - // the method will check, if an update is really required - // these are local (non DBus) calls - this->getIContextOwnAircraft()->updateOwnAircraft(aircraft, this->getPathAndContextId()); + Q_ASSERT(this->getIContextOwnAircraft()); // paranoia against context having been deleted from another thread - redmine issue #270 + if (!this->getIContextOwnAircraft()) + { + // the method will check, if an update is really required + // these are local (non DBus) calls + this->getIContextOwnAircraft()->updateOwnAircraft(aircraft, this->getPathAndContextId()); + } } void CContextSimulator::addAircraftSituation(const CCallsign &callsign, const CAircraftSituation &initialSituation)