[Bf-blender-cvs] [5308e31e419] blender2.8: Fix memleak with meshes having IDProps in modifier stack evaluation.
Bastien Montagne
noreply at git.blender.org
Wed May 16 17:37:46 CEST 2018
Commit: 5308e31e419cf80b73df2d39e218d95164287ac4
Author: Bastien Montagne
Date: Wed May 16 17:35:54 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB5308e31e419cf80b73df2d39e218d95164287ac4
Fix memleak with meshes having IDProps in modifier stack evaluation.
*Always* use BKE_library API to handle IDs allocation and freeing,
unless you have a very, very, very good reason not to do so - and
perfectly know what you are doing.
===================================================================
M source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 6486e3312b5..abbfa4b7ff1 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2329,8 +2329,8 @@ static void mesh_calc_modifiers(
if (new_mesh) {
/* if the modifier returned a new mesh, release the old one */
if (mesh && mesh != new_mesh) {
- BKE_mesh_free(mesh);
- MEM_freeN(mesh);
+ BLI_assert(mesh != me);
+ BKE_id_free(NULL, mesh);
}
mesh = new_mesh;
@@ -2360,6 +2360,7 @@ static void mesh_calc_modifiers(
if (new_mesh) {
/* if the modifier returned a new mesh, release the old one */
if (orco_mesh && orco_mesh != new_mesh) {
+ BLI_assert(orco_mesh != me);
BKE_id_free(NULL, orco_mesh);
}
@@ -2369,8 +2370,9 @@ static void mesh_calc_modifiers(
/* create cloth orco mesh in parallel */
if (nextmask & CD_MASK_CLOTH_ORCO) {
- if (!cloth_orco_mesh)
+ if (!cloth_orco_mesh) {
cloth_orco_mesh = create_orco_mesh(ob, me, NULL, CD_CLOTH_ORCO);
+ }
nextmask &= ~CD_MASK_CLOTH_ORCO;
mesh_set_only_copy(cloth_orco_mesh, nextmask | CD_MASK_ORIGINDEX);
@@ -2381,6 +2383,7 @@ static void mesh_calc_modifiers(
if (new_mesh) {
/* if the modifier returned a new mesh, release the old one */
if (cloth_orco_mesh && cloth_orco_mesh != new_mesh) {
+ BLI_assert(orco_mesh != me);
BKE_id_free(NULL, cloth_orco_mesh);
}
More information about the Bf-blender-cvs
mailing list