Mathias Frhlich:
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).
This commit is contained in:
parent
2b57eb167a
commit
54a33c3899
5 changed files with 8 additions and 4 deletions
|
@ -81,6 +81,8 @@ FGAIBase::~FGAIBase() {
|
||||||
root->removeChild(_type_str.c_str(), index);
|
root->removeChild(_type_str.c_str(), index);
|
||||||
delete fp;
|
delete fp;
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
ssgDeRefDelete(model);
|
||||||
|
model = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGAIBase::update(double dt) {
|
void FGAIBase::update(double dt) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ FGAIEntity::FGAIEntity() {
|
||||||
|
|
||||||
FGAIEntity::~FGAIEntity() {
|
FGAIEntity::~FGAIEntity() {
|
||||||
//cout << "FGAIEntity dtor called..." << endl;
|
//cout << "FGAIEntity dtor called..." << endl;
|
||||||
_model->deRef(); // Ought to check valid?
|
ssgDeRefDelete(_model); // Ought to check valid?
|
||||||
//cout << "Removing model from scene graph..." << endl;
|
//cout << "Removing model from scene graph..." << endl;
|
||||||
globals->get_scenery()->get_scene_graph()->removeKid(_aip.getSceneGraph());
|
globals->get_scenery()->get_scene_graph()->removeKid(_aip.getSceneGraph());
|
||||||
// Unregister that one at the scenery manager
|
// Unregister that one at the scenery manager
|
||||||
|
|
|
@ -57,8 +57,8 @@ FGAIMgr::FGAIMgr() {
|
||||||
}
|
}
|
||||||
|
|
||||||
FGAIMgr::~FGAIMgr() {
|
FGAIMgr::~FGAIMgr() {
|
||||||
_defaultModel->deRef();
|
ssgDeRefDelete(_defaultModel);
|
||||||
if(_havePiperModel) _piperModel->deRef();
|
if(_havePiperModel) ssgDeRefDelete(_piperModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGAIMgr::init() {
|
void FGAIMgr::init() {
|
||||||
|
|
|
@ -70,6 +70,8 @@ wxRadarBg::wxRadarBg ()
|
||||||
|
|
||||||
wxRadarBg::~wxRadarBg ()
|
wxRadarBg::~wxRadarBg ()
|
||||||
{
|
{
|
||||||
|
ssgDeRefDelete(resultTexture);
|
||||||
|
ssgDeRefDelete(wxEcho);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -123,8 +123,8 @@ void FGScenery::unregister_placement_transform(ssgPlacementTransform *trans) {
|
||||||
placement_list_type::iterator it = _placement_list.begin();
|
placement_list_type::iterator it = _placement_list.begin();
|
||||||
while (it != _placement_list.end()) {
|
while (it != _placement_list.end()) {
|
||||||
if ((*it) == trans) {
|
if ((*it) == trans) {
|
||||||
(*it)->deRef();
|
|
||||||
it = _placement_list.erase(it);
|
it = _placement_list.erase(it);
|
||||||
|
ssgDeRefDelete(trans);
|
||||||
} else
|
} else
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue