Route-manager was explicitly deleting its FP, which was incorrect.
Switch to correct use of SGSharedPtr to refer to flight plans.
Thanks to Roland Haeder for catching this.
return true;
}
-FlightPlan* FGRouteMgr::flightPlan() const
+FlightPlanRef FGRouteMgr::flightPlan() const
{
return _plan;
}
-void FGRouteMgr::setFlightPlan(FlightPlan* plan)
+void FGRouteMgr::setFlightPlan(const FlightPlanRef& plan)
{
if (plan == _plan) {
return;
if (_plan) {
_plan->removeDelegate(this);
- delete _plan;
active->setBoolValue(false);
}
int currentIndex() const;
- void setFlightPlan(flightgear::FlightPlan* plan);
- flightgear::FlightPlan* flightPlan() const;
+ void setFlightPlan(const flightgear::FlightPlanRef& plan);
+ flightgear::FlightPlanRef flightPlan() const;
void clearRoute();
bool commandDefineUserWaypoint(const SGPropertyNode* arg);
bool commandDeleteUserWaypoint(const SGPropertyNode* arg);
- flightgear::FlightPlan* _plan;
+ flightgear::FlightPlanRef _plan;
time_t _takeoffTime;
time_t _touchdownTime;
delete cur;
}
}
+
+// delete legs
+ BOOST_FOREACH(Leg* l, _legs) {
+ delete l;
+ }
}
FlightPlan* FlightPlan::clone(const string& newIdent) const
_deleteWithPlan(false),
_inner(NULL)
{
-
}
FlightPlan::Delegate::~Delegate()
-{
-
+{
}
void FlightPlan::Delegate::removeInner(Delegate* d)
{
if (!_inner) {
- return;
+ throw sg_exception("FlightPlan delegate not found");
}
if (_inner == d) {
{
class Transition;
-
+class FlightPlan;
+
+typedef SGSharedPtr<FlightPlan> FlightPlanRef;
+
class FlightPlan : public RouteBase
{
public: