diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index 5141807e..6b23d310 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -96,7 +96,7 @@ void SGMaterial::_internal_state::add_texture(const std::string &t, int i) SGMaterial::SGMaterial( const SGReaderWriterOptions* options, const SGPropertyNode *props, SGPropertyNode *prop_root, - AreaList *a, + std::shared_ptr a, SGSharedPtr c) { init(); @@ -109,7 +109,7 @@ SGMaterial::SGMaterial( const SGReaderWriterOptions* options, SGMaterial::SGMaterial( const osgDB::Options* options, const SGPropertyNode *props, SGPropertyNode *prop_root, - AreaList *a, + std::shared_ptr a, SGSharedPtr c) { osg::ref_ptr opt; @@ -412,7 +412,6 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, if (props->hasChild("parameters")) { parameters = props->getChild("parameters"); } else { - // REVIEW: Memory Leak - 61,560 bytes in 405 blocks are definitely lost parameters = new SGPropertyNode(); } } diff --git a/simgear/scene/material/mat.hxx b/simgear/scene/material/mat.hxx index c48caf9b..60f2c229 100644 --- a/simgear/scene/material/mat.hxx +++ b/simgear/scene/material/mat.hxx @@ -31,6 +31,7 @@ #include // Standard C++ string library #include #include +#include #include #include "Effect.hxx" @@ -96,15 +97,15 @@ public: SGMaterial(const osgDB::Options*, const SGPropertyNode *props, SGPropertyNode *prop_root, - AreaList *a, - SGSharedPtr c); + std::shared_ptr a, + SGSharedPtr c); SGMaterial(const simgear::SGReaderWriterOptions*, const SGPropertyNode *props, SGPropertyNode *prop_root, - AreaList *a, - SGSharedPtr c); + std::shared_ptr a, + SGSharedPtr c); /** * Destructor. @@ -512,10 +513,10 @@ private: SGSharedPtr condition; // List of geographical rectangles for this material - AreaList* areas; + std::shared_ptr areas; // Parameters from the materials file - const SGPropertyNode* parameters; + SGConstPropertyNode_ptr parameters; // per-material lock for entrypoints called from multiple threads std::mutex _lock;