X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fprops%2FpropertyObject.cxx;h=7a46056080ea67b153c27d53d4628d4c2abbd8cf;hb=2acac617fcf27b49a9396e9c040c8b4b437529f1;hp=df3f81f990004088dbb2d88044cf95b7c2846105;hpb=be720709febd0a99e5900e7a74b45d8e1212fadb;p=simgear.git diff --git a/simgear/props/propertyObject.cxx b/simgear/props/propertyObject.cxx index df3f81f9..7a460560 100644 --- a/simgear/props/propertyObject.cxx +++ b/simgear/props/propertyObject.cxx @@ -21,8 +21,6 @@ #include "propertyObject.hxx" -#include - #include namespace simgear @@ -34,6 +32,13 @@ void PropertyObjectBase::setDefaultRoot(SGPropertyNode* aRoot) { static_defaultRoot = aRoot; } + +PropertyObjectBase::PropertyObjectBase() : + _path(NULL), + _prop(NULL) +{ + +} PropertyObjectBase::PropertyObjectBase(const PropertyObjectBase& aOther) : _path(aOther._path), @@ -61,15 +66,17 @@ SGPropertyNode* PropertyObjectBase::node(bool aCreate) const return _prop; } - SGPropertyNode* r = _prop ? _prop : static_defaultRoot; - _prop = r->getNode(_path, aCreate); + SGPropertyNode *r = _prop ? _prop : static_defaultRoot, + *prop = r->getNode(_path, aCreate); - if (_prop) { - // resolve worked, we will cache from now on, so clear _path + if( prop ) + { + // resolve worked, we will cache from now on, so clear _path and cache prop _path = NULL; + _prop = prop; } - return _prop; + return prop; } SGPropertyNode* PropertyObjectBase::getOrThrow() const