From: ehofman Date: Sat, 15 Oct 2005 14:51:52 +0000 (+0000) Subject: Mathias Fröhlich: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=54a33c3899f69edeb66818bf5b2a3af40d266058;p=flightgear.git Mathias Fröhlich: 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). --- diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index bb66a9b97..db006f9b3 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -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) { diff --git a/src/ATC/AIEntity.cxx b/src/ATC/AIEntity.cxx index 5736f2cbd..945668a15 100644 --- a/src/ATC/AIEntity.cxx +++ b/src/ATC/AIEntity.cxx @@ -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 diff --git a/src/ATC/AIMgr.cxx b/src/ATC/AIMgr.cxx index 629d5d97b..c7c7c4744 100644 --- a/src/ATC/AIMgr.cxx +++ b/src/ATC/AIMgr.cxx @@ -57,8 +57,8 @@ FGAIMgr::FGAIMgr() { } FGAIMgr::~FGAIMgr() { - _defaultModel->deRef(); - if(_havePiperModel) _piperModel->deRef(); + ssgDeRefDelete(_defaultModel); + if(_havePiperModel) ssgDeRefDelete(_piperModel); } void FGAIMgr::init() { diff --git a/src/Instrumentation/wxradar.cxx b/src/Instrumentation/wxradar.cxx index a233433c1..a6dea2399 100644 --- a/src/Instrumentation/wxradar.cxx +++ b/src/Instrumentation/wxradar.cxx @@ -70,6 +70,8 @@ wxRadarBg::wxRadarBg () wxRadarBg::~wxRadarBg () { + ssgDeRefDelete(resultTexture); + ssgDeRefDelete(wxEcho); } void diff --git a/src/Scenery/scenery.cxx b/src/Scenery/scenery.cxx index 88badf93e..51e26ae67 100644 --- a/src/Scenery/scenery.cxx +++ b/src/Scenery/scenery.cxx @@ -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; }