diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index a0bef75a9..43c92c4f5 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -691,7 +691,8 @@ void OpenGEXImporter::handleTransformNode( ODDLParser::DDLNode *node, aiScene * void OpenGEXImporter::handleMeshNode( ODDLParser::DDLNode *node, aiScene *pScene ) { m_currentMesh = new aiMesh; const size_t meshidx( m_meshCache.size() ); - m_meshCache.push_back( m_currentMesh ); + // ownership is transfered but a reference remains in m_currentMesh + m_meshCache.emplace_back( m_currentMesh ); Property *prop = node->getProperties(); if( nullptr != prop ) { @@ -1138,7 +1139,7 @@ void OpenGEXImporter::copyMeshes( aiScene *pScene ) { pScene->mNumMeshes = static_cast(m_meshCache.size()); pScene->mMeshes = new aiMesh*[ pScene->mNumMeshes ]; for (unsigned int i = 0; i < pScene->mNumMeshes; i++) { - pScene->mMeshes[i] = m_meshCache[i]; + pScene->mMeshes[i] = m_meshCache[i].release(); } } diff --git a/code/OpenGEXImporter.h b/code/OpenGEXImporter.h index 5b87d5ce5..8e86a4aa8 100644 --- a/code/OpenGEXImporter.h +++ b/code/OpenGEXImporter.h @@ -183,7 +183,7 @@ private: typedef std::map > NodeChildMap; NodeChildMap m_nodeChildMap; - std::vector m_meshCache; + std::vector > m_meshCache; typedef std::map ReferenceMap; std::map m_mesh2refMap; std::map m_material2refMap;