]> git.mxchange.org Git - flightgear.git/commitdiff
Untie all TiedPropertyLists before destruction.
authorThorstenB <brehmt@gmail.com>
Mon, 7 Mar 2011 18:37:04 +0000 (19:37 +0100)
committerThorstenB <brehmt@gmail.com>
Mon, 7 Mar 2011 18:38:48 +0000 (19:38 +0100)
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.

src/Environment/realwx_ctrl.cxx
src/FDM/TankProperties.cxx
src/FDM/TankProperties.hxx
src/FDM/fdm_shell.cxx
src/Main/globals.cxx

index 087040486bb6ff2dc85339ec21669bcd1261a515..03db5a87a1b8363106b57b54afd721d6f632f1ff 100644 (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;
 };
 
index d42871a61f9f497fd5a7fff4106ee089009833e0..64d47882e193d4a1103a702cda16784aefbb3fd5 100644 (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();
+}
index f1ec8b4aa5c29e30120c62cda51fd3656195c2da..4a61d2d99277f055b4634f6f026bd12cab541999 100644 (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;
 };
index dff0d40fe4844a2156ba968159a02a95d20d8796..e630c7befc1acb2ce9d1af4e9764f16e9ef2f2b2 100644 (file)
@@ -102,6 +102,7 @@ void FDMShell::bind()
 void FDMShell::unbind()
 {
   if( _impl ) _impl->unbind();
+  _tankProperties.unbind();
 }
 
 void FDMShell::update(double dt)
index 2c1156c1a60d863de4940b7c85848e7e62d7557d..af4e693459bce2da14c45ce1e1ebd9342388142d 100644 (file)
@@ -182,6 +182,7 @@ FGGlobals::~FGGlobals()
     delete current_panel;
 
     delete ATC_mgr;
+    controls->unbind();
     delete controls;
 
     delete channel_options_list;