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).
root->removeChild(_type_str.c_str(), index);
delete fp;
fp = NULL;
+ ssgDeRefDelete(model);
+ model = 0;
}
void FGAIBase::update(double dt) {
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
}
FGAIMgr::~FGAIMgr() {
- _defaultModel->deRef();
- if(_havePiperModel) _piperModel->deRef();
+ ssgDeRefDelete(_defaultModel);
+ if(_havePiperModel) ssgDeRefDelete(_piperModel);
}
void FGAIMgr::init() {
wxRadarBg::~wxRadarBg ()
{
+ ssgDeRefDelete(resultTexture);
+ ssgDeRefDelete(wxEcho);
}
void
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;
}