1
0
Fork 0

src/Model/panelnode.cxx: Do not leave dangling pointers behind.

This commit is contained in:
Anders Gidenstam 2010-08-03 20:56:48 +02:00
parent 0d0751e37c
commit 756e719b20

View file

@ -6,6 +6,7 @@
#include <simgear/structure/exception.hxx>
#include <vector>
#include <algorithm>
#include <Cockpit/panel.hxx>
#include <Cockpit/panel_io.hxx>
@ -119,6 +120,11 @@ FGPanelNode::FGPanelNode(SGPropertyNode* props)
FGPanelNode::~FGPanelNode()
{
vector<FGPanelNode*>::iterator i =
find(all_3d_panels.begin(), all_3d_panels.end(), this);
if (i != all_3d_panels.end()) {
all_3d_panels.erase(i);
}
delete _panel;
}