From aac41cf2c3565d0f7697c475b5f48ee5c4331569 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Tue, 2 Jan 2018 20:28:08 +0200 Subject: [PATCH] MMD: Fix delete / delete[] mismatch Also this was a horrible abuse of std::vector and shouldn't have worked --- code/MMDImporter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/MMDImporter.cpp b/code/MMDImporter.cpp index c813063ab..5d4bd137a 100644 --- a/code/MMDImporter.cpp +++ b/code/MMDImporter.cpp @@ -324,8 +324,10 @@ aiMesh *MMDImporter::CreateMesh(const pmx::PmxModel *pModel, auto it = bone_vertex_map.find(ii); if (it != bone_vertex_map.end()) { pBone->mNumWeights = static_cast(it->second.size()); - pBone->mWeights = it->second.data(); - it->second.swap(*(new vector)); + pBone->mWeights = new aiVertexWeight[pBone->mNumWeights]; + for (unsigned int j = 0; j < pBone->mNumWeights; j++) { + pBone->mWeights[j] = it->second[j]; + } } bone_ptr_ptr[ii] = pBone; }