From 85fbcf8a0f421ebb8946bd4d9990ffe97240d14c Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Thu, 6 Jun 2024 17:39:10 +0200 Subject: [PATCH] Fix memory allocation issue when destroying a ConvexMesh --- CHANGELOG.md | 1 + src/engine/PhysicsCommon.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c5a4cca..410097cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Issue [#377](https://github.com/DanielChappuis/reactphysics3d/issues/377) Assert when destroying an empty PhysicsWorld - Issue [#378](https://github.com/DanielChappuis/reactphysics3d/issues/378) Wrong raycasting result against the HeightFieldShape +- Issue [#387](https://github.com/DanielChappuis/reactphysics3d/issues/387) Fix memory allocation issue when destroying a ConvexMesh - Fix crash within testbed application in raycasting scene - Fix robustness issue with CapsuleShape vs CapsuleShape collision diff --git a/src/engine/PhysicsCommon.cpp b/src/engine/PhysicsCommon.cpp index b4efcedb..fa536d69 100644 --- a/src/engine/PhysicsCommon.cpp +++ b/src/engine/PhysicsCommon.cpp @@ -617,7 +617,7 @@ ConvexMesh* PhysicsCommon::createConvexMesh(const PolygonVertexArray& polygonVer // If the mesh is not valid if (!isValid) { mesh->~ConvexMesh(); - allocator.release(mesh, sizeof(ConvexMesh)); + mMemoryManager.release(MemoryManager::AllocationType::Pool, mesh, sizeof(ConvexMesh)); return nullptr; } @@ -661,7 +661,7 @@ ConvexMesh* PhysicsCommon::createConvexMesh(const VertexArray& vertexArray, std: // If the mesh is not valid if (!isValid) { mesh->~ConvexMesh(); - allocator.release(mesh, sizeof(ConvexMesh)); + mMemoryManager.release(MemoryManager::AllocationType::Pool, mesh, sizeof(ConvexMesh)); return nullptr; }