Added a clear of allocated Records and the cache's in flt::Registry to

prevent memory leaks and unneccesary references to model models remaining
beyond the scope of the loader.
This commit is contained in:
Robert Osfield
2003-03-18 20:10:51 +00:00
parent e978c405e1
commit b04edb70aa
9 changed files with 59 additions and 40 deletions

View File

@@ -6,6 +6,7 @@
#include "ReaderWriterFLT.h"
#include "FltFile.h"
#include "Registry.h"
#include <osg/Object>
#include <osg/Node>
@@ -27,7 +28,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readNode(const std::string& fil
return ReadResult::FILE_NOT_HANDLED;
osg::ref_ptr<FltFile> read = new FltFile;
if (options)
{
read->setUseTextureAlphaForTransparancyBinning(options->getOptionString().find("noTextureAlphaForTransparancyBinning")==std::string::npos);
@@ -35,6 +36,9 @@ osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readNode(const std::string& fil
}
osg::Node* node = read->readNode(fileName);
flt::Registry::instance()->clearObjectCache();
if (node) return node;
else return ReadResult::FILE_NOT_HANDLED;
}