1
0
Fork 0

Untie all TiedPropertyLists before destruction.

Untieing needs to be done prior to the destruction of the object which
aggregated the TiedPropertyList. So the TiedPropertyLists destructor can't
untie the properties automatically (and it doesn't). So, do some manual
clean-up.
This commit is contained in:
ThorstenB 2011-03-07 19:37:04 +01:00
parent 4761a3cdcf
commit f6fde388a2
5 changed files with 20 additions and 2 deletions

View file

@ -69,6 +69,7 @@ LiveMetarProperties::LiveMetarProperties( SGPropertyNode_ptr rootNode ) :
LiveMetarProperties::~LiveMetarProperties()
{
_tiedProperties.Untie();
}
void LiveMetarProperties::update( double dt )
@ -106,7 +107,7 @@ protected:
bool _enabled;
bool __enabled;
simgear::TiedPropertyList _tiedProperties;
; typedef std::vector<LiveMetarProperties_ptr> MetarPropertiesList;
typedef std::vector<LiveMetarProperties_ptr> MetarPropertiesList;
MetarPropertiesList _metarProperties;
};

View file

@ -68,6 +68,11 @@ TankProperties::~TankProperties()
{
}
void TankProperties::unbind()
{
_tiedProperties.Untie();
}
double TankProperties::getContent_kg() const
{
return _content_kg;
@ -286,4 +291,10 @@ double TankPropertiesList::getTotalContent_norm() const
return capacity > SGLimitsd::min() ? content / capacity : 0.0;
}
void TankPropertiesList::unbind()
{
for( const_iterator it = begin(); it != end(); ++it ) {
(*it)->unbind();
}
_tiedProperties.Untie();
}

View file

@ -34,6 +34,8 @@ public:
TankProperties( const TankProperties & );
const TankProperties & operator = ( const TankProperties & );
void unbind();
double getContent_kg() const;
void setContent_kg( double value );
@ -98,6 +100,8 @@ public:
double getTotalContent_m3() const;
double getTotalContent_norm() const;
void unbind();
private:
simgear::TiedPropertyList _tiedProperties;
};

View file

@ -102,6 +102,7 @@ void FDMShell::bind()
void FDMShell::unbind()
{
if( _impl ) _impl->unbind();
_tankProperties.unbind();
}
void FDMShell::update(double dt)

View file

@ -182,6 +182,7 @@ FGGlobals::~FGGlobals()
delete current_panel;
delete ATC_mgr;
controls->unbind();
delete controls;
delete channel_options_list;