OpenGEXImporter: Store ChildInfo in unique_ptr so they get automatically cleaned up
parent
316046f748
commit
b6d2b91799
|
@ -1231,9 +1231,9 @@ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
|
||||||
if( m_nodeChildMap.end() == it ) {
|
if( m_nodeChildMap.end() == it ) {
|
||||||
info = new ChildInfo;
|
info = new ChildInfo;
|
||||||
m_root = info;
|
m_root = info;
|
||||||
m_nodeChildMap[ node->mParent ] = info;
|
m_nodeChildMap[ node->mParent ] = std::unique_ptr<ChildInfo>(info);
|
||||||
} else {
|
} else {
|
||||||
info = it->second;
|
info = it->second.get();
|
||||||
}
|
}
|
||||||
info->m_children.push_back( node );
|
info->m_children.push_back( node );
|
||||||
} else {
|
} else {
|
||||||
|
@ -1243,9 +1243,9 @@ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
|
||||||
NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) );
|
NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) );
|
||||||
if( m_nodeChildMap.end() == it ) {
|
if( m_nodeChildMap.end() == it ) {
|
||||||
info = new ChildInfo;
|
info = new ChildInfo;
|
||||||
m_nodeChildMap[ node->mParent ] = info;
|
m_nodeChildMap[ node->mParent ] = std::unique_ptr<ChildInfo>(info);
|
||||||
} else {
|
} else {
|
||||||
info = it->second;
|
info = it->second.get();
|
||||||
}
|
}
|
||||||
info->m_children.push_back( node );
|
info->m_children.push_back( node );
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace ODDLParser {
|
namespace ODDLParser {
|
||||||
class DDLNode;
|
class DDLNode;
|
||||||
|
@ -179,7 +180,7 @@ private:
|
||||||
std::list<aiNode*> m_children;
|
std::list<aiNode*> m_children;
|
||||||
};
|
};
|
||||||
ChildInfo *m_root;
|
ChildInfo *m_root;
|
||||||
typedef std::map<aiNode*, ChildInfo*> NodeChildMap;
|
typedef std::map<aiNode*, std::unique_ptr<ChildInfo> > NodeChildMap;
|
||||||
NodeChildMap m_nodeChildMap;
|
NodeChildMap m_nodeChildMap;
|
||||||
|
|
||||||
std::vector<aiMesh*> m_meshCache;
|
std::vector<aiMesh*> m_meshCache;
|
||||||
|
|
Loading…
Reference in New Issue