Forráskód Böngészése

MMD: Fix delete / delete[] mismatch

Also this was a horrible abuse of std::vector and shouldn't have worked
Turo Lamminen 7 éve
szülő
commit
aac41cf2c3
1 módosított fájl, 4 hozzáadás és 2 törlés
  1. 4 2
      code/MMDImporter.cpp

+ 4 - 2
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<unsigned int>(it->second.size());
-      pBone->mWeights = it->second.data();
-      it->second.swap(*(new vector<aiVertexWeight>));
+      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;
   }