fix bug #177: crash caused by route manager/gps/navradio
Uninitialized variables were sources for NaN values. Once NaNs are passed to Nasal (through (tied) properties), these cause a crash. Nasal cannot handle NaNs - it interprets these as pointer values...
This commit is contained in:
parent
d1601ff8b2
commit
ebbd5bfd05
4 changed files with 39 additions and 14 deletions
|
@ -92,12 +92,19 @@ SGPropertyNode_ptr createServiceableProp(SGPropertyNode* aParent, const char* aN
|
|||
|
||||
// Constructor
|
||||
FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
||||
term_tbl(NULL),
|
||||
low_tbl(NULL),
|
||||
high_tbl(NULL),
|
||||
lon_node(fgGetNode("/position/longitude-deg", true)),
|
||||
lat_node(fgGetNode("/position/latitude-deg", true)),
|
||||
alt_node(fgGetNode("/position/altitude-ft", true)),
|
||||
_operable(false),
|
||||
play_count(0),
|
||||
last_time(0),
|
||||
target_radial(0.0),
|
||||
effective_range(0.0),
|
||||
target_gs(0.0),
|
||||
twist(0.0),
|
||||
horiz_vel(0.0),
|
||||
last_x(0.0),
|
||||
last_loc_dist(0.0),
|
||||
|
@ -107,6 +114,16 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
|||
_name(node->getStringValue("name", "nav")),
|
||||
_num(node->getIntValue("number", 0)),
|
||||
_time_before_search_sec(-1.0),
|
||||
_gsCart(SGVec3d::zeros()),
|
||||
_gsAxis(SGVec3d::zeros()),
|
||||
_gsVertical(SGVec3d::zeros()),
|
||||
_dmeInRange(false),
|
||||
_toFlag(false),
|
||||
_fromFlag(false),
|
||||
_cdiDeflection(0.0),
|
||||
_cdiCrossTrackErrorM(0.0),
|
||||
_gsNeedleDeflection(0.0),
|
||||
_gsNeedleDeflectionNorm(0.0),
|
||||
_sgr(NULL)
|
||||
{
|
||||
SGPath path( globals->get_fg_root() );
|
||||
|
@ -120,8 +137,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
|||
term_tbl = new SGInterpTable( term.str() );
|
||||
low_tbl = new SGInterpTable( low.str() );
|
||||
high_tbl = new SGInterpTable( high.str() );
|
||||
|
||||
|
||||
|
||||
string branch("/instrumentation/" + _name);
|
||||
_radio_node = fgGetNode(branch.c_str(), _num, true);
|
||||
}
|
||||
|
|
|
@ -137,8 +137,6 @@ class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener
|
|||
string dme_fx_name;
|
||||
|
||||
double target_radial;
|
||||
SGTimeStamp prev_time;
|
||||
SGTimeStamp curr_time;
|
||||
double effective_range;
|
||||
double target_gs;
|
||||
double twist;
|
||||
|
|
|
@ -69,8 +69,8 @@ bool geocRadialIntersection(const SGGeoc& a, double r1, const SGGeoc& b, double
|
|||
double crs12 = SGGeodesy::courseRad(a, b),
|
||||
crs21 = SGGeodesy::courseRad(b, a);
|
||||
|
||||
double degCrs12 = crs12 * SG_RADIANS_TO_DEGREES;
|
||||
double degCrs21 = crs21 * SG_RADIANS_TO_DEGREES;
|
||||
//double degCrs12 = crs12 * SG_RADIANS_TO_DEGREES;
|
||||
//double degCrs21 = crs21 * SG_RADIANS_TO_DEGREES;
|
||||
|
||||
/*
|
||||
if (sin(diffLon) < 0.0) {
|
||||
|
@ -157,7 +157,9 @@ class BasicWayptCtl : public WayptController
|
|||
{
|
||||
public:
|
||||
BasicWayptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||
WayptController(aRNAV, aWpt)
|
||||
WayptController(aRNAV, aWpt),
|
||||
_distanceM(0.0),
|
||||
_courseDev(0.0)
|
||||
{
|
||||
if (aWpt->flag(WPT_DYNAMIC)) {
|
||||
throw sg_exception("BasicWayptCtrl doesn't work with dynamic waypoints");
|
||||
|
@ -226,7 +228,10 @@ class RunwayCtl : public WayptController
|
|||
{
|
||||
public:
|
||||
RunwayCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||
WayptController(aRNAV, aWpt)
|
||||
WayptController(aRNAV, aWpt),
|
||||
_runway(NULL),
|
||||
_distanceM(0.0),
|
||||
_courseDev(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -365,8 +370,8 @@ class InterceptCtl : public WayptController
|
|||
{
|
||||
public:
|
||||
InterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||
WayptController(aRNAV, aWpt)
|
||||
|
||||
WayptController(aRNAV, aWpt),
|
||||
_trueRadial(0.0)
|
||||
{
|
||||
if (_waypt->type() != "radialIntercept") {
|
||||
throw sg_exception("invalid waypoint type", "InterceptCtl ctor");
|
||||
|
@ -412,8 +417,9 @@ class DMEInterceptCtl : public WayptController
|
|||
{
|
||||
public:
|
||||
DMEInterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||
WayptController(aRNAV, aWpt)
|
||||
|
||||
WayptController(aRNAV, aWpt),
|
||||
_dme(NULL),
|
||||
_distanceNm(0.0)
|
||||
{
|
||||
if (_waypt->type() != "dmeIntercept") {
|
||||
throw sg_exception("invalid waypoint type", "DMEInterceptCtl ctor");
|
||||
|
@ -546,7 +552,9 @@ private:
|
|||
|
||||
DirectToController::DirectToController(RNAV* aRNAV, const WayptRef& aWpt, const SGGeod& aOrigin) :
|
||||
WayptController(aRNAV, aWpt),
|
||||
_origin(aOrigin)
|
||||
_origin(aOrigin),
|
||||
_distanceM(0.0),
|
||||
_courseDev(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -600,7 +608,9 @@ SGGeod DirectToController::position() const
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
OBSController::OBSController(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||
WayptController(aRNAV, aWpt)
|
||||
WayptController(aRNAV, aWpt),
|
||||
_distanceM(0.0),
|
||||
_courseDev(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ public:
|
|||
protected:
|
||||
WayptController(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||
_waypt(aWpt),
|
||||
_targetTrack(0),
|
||||
_rnav(aRNAV),
|
||||
_isDone(false)
|
||||
{ }
|
||||
|
|
Loading…
Reference in a new issue