Memory Leak Fix - SGMaterial
Reclaimed 61,560 bytes in 405 blocks
This commit is contained in:
@@ -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<AreaList> a,
|
||||
SGSharedPtr<const SGCondition> 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<AreaList> a,
|
||||
SGSharedPtr<const SGCondition> c)
|
||||
{
|
||||
osg::ref_ptr<SGReaderWriterOptions> 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <string> // Standard C++ string library
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "Effect.hxx"
|
||||
@@ -96,15 +97,15 @@ public:
|
||||
SGMaterial(const osgDB::Options*,
|
||||
const SGPropertyNode *props,
|
||||
SGPropertyNode *prop_root,
|
||||
AreaList *a,
|
||||
SGSharedPtr<const SGCondition> c);
|
||||
std::shared_ptr<AreaList> a,
|
||||
SGSharedPtr<const SGCondition> c);
|
||||
|
||||
|
||||
SGMaterial(const simgear::SGReaderWriterOptions*,
|
||||
const SGPropertyNode *props,
|
||||
SGPropertyNode *prop_root,
|
||||
AreaList *a,
|
||||
SGSharedPtr<const SGCondition> c);
|
||||
std::shared_ptr<AreaList> a,
|
||||
SGSharedPtr<const SGCondition> c);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
@@ -512,10 +513,10 @@ private:
|
||||
SGSharedPtr<const SGCondition> condition;
|
||||
|
||||
// List of geographical rectangles for this material
|
||||
AreaList* areas;
|
||||
std::shared_ptr<AreaList> areas;
|
||||
|
||||
// Parameters from the materials file
|
||||
const SGPropertyNode* parameters;
|
||||
SGConstPropertyNode_ptr parameters;
|
||||
|
||||
// per-material lock for entrypoints called from multiple threads
|
||||
std::mutex _lock;
|
||||
|
||||
Reference in New Issue
Block a user