]> git.mxchange.org Git - flightgear.git/commitdiff
Mathias Fröhlich:
authorehofman <ehofman>
Sat, 15 Oct 2005 14:51:52 +0000 (14:51 +0000)
committerehofman <ehofman>
Sat, 15 Oct 2005 14:51:52 +0000 (14:51 +0000)
I had a quick view over the ssgBase::ref() calls in flightgear.
I made them all symmetric and used ssgDeRefDelete to dereference them.
This has the basic advantage that ssgDeRefDelete additionaly deletes the
memory instead of just decrementing the reference cound without deletion ...

This includes an incorrect deref instead of a ssgDeRefDelete in the placement
transform registration I introduced earlier. I believe that this causes the
problems with long flights (unverified, but with a big propability).

src/AIModel/AIBase.cxx
src/ATC/AIEntity.cxx
src/ATC/AIMgr.cxx
src/Instrumentation/wxradar.cxx
src/Scenery/scenery.cxx

index bb66a9b9777d4b84a3542121c6dd61450dd1d1b6..db006f9b3bb350b7de415b768c66822cbeab8e12 100644 (file)
@@ -81,6 +81,8 @@ FGAIBase::~FGAIBase() {
     root->removeChild(_type_str.c_str(), index);
     delete fp;
     fp = NULL;
+    ssgDeRefDelete(model);
+    model = 0;
 }
 
 void FGAIBase::update(double dt) {
index 5736f2cbd9e635ad820b6c01e2ea8554acb29350..945668a15b227e3eb67928d19d541560a05ab67b 100644 (file)
@@ -45,7 +45,7 @@ FGAIEntity::FGAIEntity() {
 
 FGAIEntity::~FGAIEntity() {
        //cout << "FGAIEntity dtor called..." << endl;
-       _model->deRef();        // Ought to check valid?
+        ssgDeRefDelete(_model);        // Ought to check valid?
        //cout << "Removing model from scene graph..." << endl;
        globals->get_scenery()->get_scene_graph()->removeKid(_aip.getSceneGraph());
         // Unregister that one at the scenery manager
index 629d5d97b09f1d4db7c36233c7c64d5a93d011ec..c7c7c47446f57d18e5ef760f071fb8e97a1f49b7 100644 (file)
@@ -57,8 +57,8 @@ FGAIMgr::FGAIMgr() {
 }
 
 FGAIMgr::~FGAIMgr() {
-       _defaultModel->deRef();
-       if(_havePiperModel) _piperModel->deRef();
+        ssgDeRefDelete(_defaultModel);
+       if(_havePiperModel) ssgDeRefDelete(_piperModel);
 }
 
 void FGAIMgr::init() {
index a233433c1bdf8b1d86da764ddcaf27cd6a53e784..a6dea2399ffaf992e27d5b50834d4ef7484f7aad 100644 (file)
@@ -70,6 +70,8 @@ wxRadarBg::wxRadarBg ()
 
 wxRadarBg::~wxRadarBg ()
 {
+    ssgDeRefDelete(resultTexture);
+    ssgDeRefDelete(wxEcho);
 }
 
 void
index 88badf93eea9498ce85dc92804f8071ef04a3526..51e26ae67413e00b9bc962b6686fd1dc98869031 100644 (file)
@@ -123,8 +123,8 @@ void FGScenery::unregister_placement_transform(ssgPlacementTransform *trans) {
     placement_list_type::iterator it = _placement_list.begin();
     while (it != _placement_list.end()) {
         if ((*it) == trans) {
-            (*it)->deRef();
             it = _placement_list.erase(it);        
+            ssgDeRefDelete(trans);
         } else
             ++it;
     }