Merge pull request #3788 from BaldricS/SceneCombiner_Memory_Leaks
Fix: Removing double delete of texture items after MergeScene.pull/3826/head^2
commit
f538b96e82
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// possible as new fields are added to assimp structures.
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/**
|
||||
/**
|
||||
* @file Implements Assimp::SceneCombiner. This is a smart utility
|
||||
* class that combines multiple scenes, meshes, ... into one. Currently
|
||||
* these utilities are used by the IRR and LWS loaders and the
|
||||
|
@ -359,7 +359,7 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vector<At
|
|||
|
||||
// generate the output texture list + an offset table for all texture indices
|
||||
if (dest->mNumTextures) {
|
||||
aiTexture **pip = dest->mTextures = new aiTexture *[dest->mNumMaterials];
|
||||
aiTexture **pip = dest->mTextures = new aiTexture *[dest->mNumTextures];
|
||||
cnt = 0;
|
||||
for (unsigned int n = 0; n < src.size(); ++n) {
|
||||
SceneHelper *cur = &src[n];
|
||||
|
@ -638,6 +638,8 @@ void SceneCombiner::MergeScenes(aiScene **_dest, aiScene *master, std::vector<At
|
|||
deleteMe->mMaterials = nullptr;
|
||||
delete[] deleteMe->mAnimations;
|
||||
deleteMe->mAnimations = nullptr;
|
||||
delete[] deleteMe->mTextures;
|
||||
deleteMe->mTextures = nullptr;
|
||||
|
||||
deleteMe->mRootNode = nullptr;
|
||||
|
||||
|
|
Loading…
Reference in New Issue