From 2c3f44ae118cacc2ab71ab55b76f1d646f3dbfe1 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sat, 7 Dec 2013 13:40:22 +0100 Subject: [PATCH] Canvas: ensure all canvasses are destroyed - For shutdown/reset make sure all properties describing a canvas are removed and also not restored after the reset. --- simgear/canvas/Canvas.cxx | 6 ++++++ simgear/canvas/Canvas.hxx | 1 + simgear/props/PropertyBasedMgr.cxx | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/simgear/canvas/Canvas.cxx b/simgear/canvas/Canvas.cxx index a8eab722..28fa521e 100644 --- a/simgear/canvas/Canvas.cxx +++ b/simgear/canvas/Canvas.cxx @@ -74,6 +74,12 @@ namespace canvas setStatusFlags(MISSING_SIZE_X | MISSING_SIZE_Y); } + //---------------------------------------------------------------------------- + Canvas::~Canvas() + { + + } + //---------------------------------------------------------------------------- void Canvas::onDestroy() { diff --git a/simgear/canvas/Canvas.hxx b/simgear/canvas/Canvas.hxx index 0173d8eb..6857d61d 100644 --- a/simgear/canvas/Canvas.hxx +++ b/simgear/canvas/Canvas.hxx @@ -71,6 +71,7 @@ namespace canvas typedef osg::ref_ptr CullCallbackPtr; Canvas(SGPropertyNode* node); + virtual ~Canvas(); virtual void onDestroy(); void setSystemAdapter(const SystemAdapterPtr& system_adapter); diff --git a/simgear/props/PropertyBasedMgr.cxx b/simgear/props/PropertyBasedMgr.cxx index 4091da9f..7d868d37 100644 --- a/simgear/props/PropertyBasedMgr.cxx +++ b/simgear/props/PropertyBasedMgr.cxx @@ -36,8 +36,8 @@ namespace simgear //---------------------------------------------------------------------------- void PropertyBasedMgr::shutdown() { + _props->removeAllChildren(); _props->removeChangeListener(this); - _elements.clear(); } //---------------------------------------------------------------------------- @@ -96,7 +96,7 @@ namespace simgear _name_elements( name_elements ), _element_factory( element_factory ) { - + _props->setAttribute(SGPropertyNode::PRESERVE, true); } //---------------------------------------------------------------------------- -- 2.39.5