8000 Adding boneMatrices to MeshUnmanaged to fix double free · RobLoach/raylib-cpp@b012311 · GitHub
[go: up one dir, main page]

Skip to content

Commit b012311

Browse files
author
Gani Aliguzhinov
committed
Adding boneMatrices to MeshUnmanaged to fix double free
I noticed a bug when trying out the models_first_person_maze example, that sometimes a double free occurs on UnloadMesh when destructor of MeshUnmanaged is called. The offending line is Line 1935 from rmodels.c from raylib, where RL_FREE(mesh.boneMatrices) is called. To remedy this, I added a default assignment of nullptr to boneMatrices and explicit assignment throught the set method.
1 parent 6d9d02c commit b012311

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/MeshUnmanaged.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <vector>
66

77
#include "./BoundingBox.hpp"
8+
#include "./Matrix.hpp"
89
#include "./Model.hpp"
910
#include 9AD4 "./raylib-cpp-utils.hpp"
1011
#include "./raylib.hpp"
@@ -37,6 +38,7 @@ class MeshUnmanaged : public ::Mesh {
3738
animNormals = nullptr;
3839
boneIds = nullptr;
3940
boneWeights = nullptr;
41+
boneMatrices = nullptr;
4042
vaoId = 0;
4143
vboId = nullptr;
4244
}
@@ -242,6 +244,7 @@ class MeshUnmanaged : public ::Mesh {
242244
animNormals = mesh.animNormals;
243245
boneIds = mesh.boneIds;
244246
boneWeights = mesh.boneWeights;
247+
boneMatrices = mesh.boneMatrices;
245248
vaoId = mesh.vaoId;
246249
vboId = mesh.vboId;
247250
}

0 commit comments

Comments
 (0)
0