free the allocated import

pull/753/head
wise86Android 2016-01-16 15:02:45 +01:00
parent f0fca826db
commit d51c2e6435
3 changed files with 15 additions and 3 deletions

View File

@ -96,6 +96,8 @@ namespace Assimp
/** will return all registered importers. */
void GetImporterInstanceList(std::vector< BaseImporter* >& out);
/** will delete all registered importers. */
void DeleteImporterInstanceList(std::vector< BaseImporter* >& out);
} // namespace assimp
@ -648,6 +650,8 @@ ASSIMP_API C_STRUCT const aiImporterDesc* aiGetImporterDesc( const char *extensi
}
}
DeleteImporterInstanceList(out);
return desc;
}

View File

@ -90,6 +90,8 @@ using namespace Assimp::Formatter;
namespace Assimp {
// ImporterRegistry.cpp
void GetImporterInstanceList(std::vector< BaseImporter* >& out);
void DeleteImporterInstanceList(std::vector< BaseImporter* >& out);
// PostStepRegistry.cpp
void GetPostProcessingStepInstanceList(std::vector< BaseProcess* >& out);
}
@ -173,8 +175,7 @@ Importer::Importer()
Importer::~Importer()
{
// Delete all import plugins
for( unsigned int a = 0; a < pimpl->mImporter.size(); a++)
delete pimpl->mImporter[a];
DeleteImporterInstanceList(pimpl->mImporter);
// Delete all post-processing plug-ins
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++)
@ -1113,4 +1114,3 @@ void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
}
in.total += in.materials;
}

View File

@ -321,4 +321,12 @@ void GetImporterInstanceList(std::vector< BaseImporter* >& out)
#endif
}
/** will delete all registered importers. */
void DeleteImporterInstanceList(std::vector< BaseImporter* >& deleteList){
for(size_t i= 0; i<deleteList.size();++i){
delete deleteList[i];
deleteList[i]=NULL;
}//for
}
} // namespace Assimp