X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fprops%2Ftiedpropertylist.hxx;h=f33478ac40768aee0ea60ddd4782cf70a69f5858;hb=708ae35068499af33329f9db91f55441f4956acb;hp=28cdb5183b2ffd15ed188291d941c3516b464a8b;hpb=3a0fbae4d90187d96eb991a7d7dccc339a3bcb48;p=simgear.git diff --git a/simgear/props/tiedpropertylist.hxx b/simgear/props/tiedpropertylist.hxx index 28cdb518..f33478ac 100644 --- a/simgear/props/tiedpropertylist.hxx +++ b/simgear/props/tiedpropertylist.hxx @@ -21,7 +21,7 @@ #ifndef __TIEDPROPERTYLIST_HXX #define __TIEDPROPERTYLIST_HXX #include -using simgear::PropertyList; +#include namespace simgear { @@ -30,10 +30,20 @@ namespace simgear { * This helper class keeps track of tied properties and unties * each tied property when this class gets destructed. */ -class TiedPropertyList : PropertyList { +class TiedPropertyList : simgear::PropertyList { public: TiedPropertyList() {} TiedPropertyList( SGPropertyNode_ptr root ) : _root(root) {} + virtual ~TiedPropertyList() + { + _root = 0; + if (size()>0) + { + SG_LOG(SG_GENERAL, SG_ALERT, "Detected properties with dangling ties. Use 'Untie' before removing a TiedPropertyList."); + // running debug mode: go, fix it! + assert(size() == 0); + } + } void setRoot( SGPropertyNode_ptr root ) { _root = root; } SGPropertyNode_ptr getRoot() const { return _root; }