[Bf-blender-cvs] [ac02c702e5e] master: Fix T75156: Cast modifier crash in edit-mode

Campbell Barton noreply at git.blender.org
Sun Mar 29 09:37:04 CEST 2020


Commit: ac02c702e5ecfd1a01f0c377dc30336a473580ca
Author: Campbell Barton
Date:   Sun Mar 29 16:08:22 2020 +1100
Branches: master
https://developer.blender.org/rBac02c702e5ecfd1a01f0c377dc30336a473580ca

Fix T75156: Cast modifier crash in edit-mode

Add NULL checks to other deform modifiers too.

===================================================================

M	source/blender/modifiers/intern/MOD_armature.c
M	source/blender/modifiers/intern/MOD_cast.c
M	source/blender/modifiers/intern/MOD_collision.c
M	source/blender/modifiers/intern/MOD_correctivesmooth.c
M	source/blender/modifiers/intern/MOD_particlesystem.c

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index 3e78662da6c..275c16873a8 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -234,7 +234,7 @@ static void deformMatrices(ModifierData *md,
                         amd->defgrp_name,
                         NULL);
 
-  if (mesh_src != mesh) {
+  if (!ELEM(mesh_src, NULL, mesh)) {
     BKE_id_free(NULL, mesh_src);
   }
 }
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index ed4a53ba2f3..eb6292e5e46 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -513,7 +513,7 @@ static void deformVertsEM(ModifierData *md,
     sphere_do(cmd, ctx, ctx->object, mesh_src, vertexCos, numVerts);
   }
 
-  if (mesh_src != mesh) {
+  if (!ELEM(mesh_src, NULL, mesh)) {
     BKE_id_free(NULL, mesh_src);
   }
 }
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index af468cb2d27..e1595488d08 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -231,7 +231,7 @@ static void deformVerts(ModifierData *md,
     }
   }
 
-  if (mesh_src != mesh) {
+  if (!ELEM(mesh_src, NULL, mesh)) {
     BKE_id_free(NULL, mesh_src);
   }
 }
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index 4eea9092e10..52003f8b1d8 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -740,7 +740,7 @@ static void deformVerts(ModifierData *md,
   correctivesmooth_modifier_do(
       md, ctx->depsgraph, ctx->object, mesh_src, vertexCos, (uint)numVerts, NULL);
 
-  if (mesh_src != mesh) {
+  if (!ELEM(mesh_src, NULL, mesh)) {
     BKE_id_free(NULL, mesh_src);
   }
 }
@@ -758,7 +758,7 @@ static void deformVertsEM(ModifierData *md,
   correctivesmooth_modifier_do(
       md, ctx->depsgraph, ctx->object, mesh_src, vertexCos, (uint)numVerts, editData);
 
-  if (mesh_src != mesh) {
+  if (!ELEM(mesh_src, NULL, mesh)) {
     BKE_id_free(NULL, mesh_src);
   }
 }
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index e6229e27e4b..05bfe9aeff0 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -189,7 +189,7 @@ static void deformVerts(ModifierData *md,
     BKE_mesh_tessface_ensure(psmd->mesh_original);
   }
 
-  if (mesh_src != psmd->mesh_final && mesh_src != mesh) {
+  if (!ELEM(mesh_src, NULL, mesh, psmd->mesh_final)) {
     BKE_id_free(NULL, mesh_src);
   }



More information about the Bf-blender-cvs mailing list