FGPanelNode doesn't always own its "_panel" object - so it's not ok to
always delete it. Use ref-counting/smart-pointers instead.
}
SG_LOG(SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path);
globals->get_current_panel()->unbind();
- delete globals->get_current_panel();
globals->set_current_panel( new_panel );
globals->get_current_panel()->bind();
return true;
delete mag;
delete matlib;
delete route_mgr;
- delete current_panel;
+ current_panel = NULL;
delete ATC_mgr;
FGRouteMgr *route_mgr;
// 2D panel
- FGPanel *current_panel;
+ SGSharedPtr<FGPanel> current_panel;
// ATC manager
FGATCMgr *ATC_mgr;
FGPanelNode::~FGPanelNode()
{
- delete _panel;
}
osg::Matrix FGPanelNode::transformMatrix() const
#include <osg/Vec3>
#include <osg/Matrix>
#include <osg/Drawable>
+#include <simgear/structure/SGSharedPtr.hxx>
class FGPanel;
class SGPropertyNode;
private:
void initWithPanel();
- FGPanel* _panel;
+ SGSharedPtr<FGPanel> _panel;
bool _resizeToViewport;