OpenGEXImporter: Store ChildInfo in unique_ptr so they get automatically cleaned up
parent
61278aa408
commit
22b55d01a2
|
@ -1231,9 +1231,9 @@ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
|
|||
if( m_nodeChildMap.end() == it ) {
|
||||
info = new ChildInfo;
|
||||
m_root = info;
|
||||
m_nodeChildMap[ node->mParent ] = info;
|
||||
m_nodeChildMap[ node->mParent ] = std::unique_ptr<ChildInfo>(info);
|
||||
} else {
|
||||
info = it->second;
|
||||
info = it->second.get();
|
||||
}
|
||||
info->m_children.push_back( node );
|
||||
} else {
|
||||
|
@ -1243,9 +1243,9 @@ void OpenGEXImporter::pushNode( aiNode *node, aiScene *pScene ) {
|
|||
NodeChildMap::iterator it( m_nodeChildMap.find( node->mParent ) );
|
||||
if( m_nodeChildMap.end() == it ) {
|
||||
info = new ChildInfo;
|
||||
m_nodeChildMap[ node->mParent ] = info;
|
||||
m_nodeChildMap[ node->mParent ] = std::unique_ptr<ChildInfo>(info);
|
||||
} else {
|
||||
info = it->second;
|
||||
info = it->second.get();
|
||||
}
|
||||
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 <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
namespace ODDLParser {
|
||||
class DDLNode;
|
||||
|
@ -179,7 +180,7 @@ private:
|
|||
std::list<aiNode*> m_children;
|
||||
};
|
||||
ChildInfo *m_root;
|
||||
typedef std::map<aiNode*, ChildInfo*> NodeChildMap;
|
||||
typedef std::map<aiNode*, std::unique_ptr<ChildInfo> > NodeChildMap;
|
||||
NodeChildMap m_nodeChildMap;
|
||||
|
||||
std::vector<aiMesh*> m_meshCache;
|
||||
|
|
Loading…
Reference in New Issue