[Bf-blender-cvs] [97881d0] master: Fix T39610: Shared mesh used for Mesh Deform causes crash

Sergey Sharybin noreply at git.blender.org
Tue Apr 15 14:37:54 CEST 2014


Commit: 97881d06b221fbe5db98c5e5b3d2b9ecd0a22b38
Author: Sergey Sharybin
Date:   Tue Apr 15 18:36:24 2014 +0600
https://developer.blender.org/rB97881d06b221fbe5db98c5e5b3d2b9ecd0a22b38

Fix T39610: Shared mesh used for Mesh Deform causes crash

For now disable using linked edit mesh in the meshdeform modifier.

This is because editbmesh_get_derived_cage_and_final() might easily
conflict with the thread which evaluates object which is in the edit
mode for this mesh.

We'll support this case once granular dependency graph is landed.

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

M	source/blender/modifiers/intern/MOD_meshdeform.c

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

diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index 63e60d4..9ca8955 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -35,6 +35,7 @@
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
+#include "DNA_scene_types.h"
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
@@ -187,8 +188,6 @@ static void meshdeformModifier_do(
         float (*vertexCos)[3], int numVerts)
 {
 	MeshDeformModifierData *mmd = (MeshDeformModifierData *) md;
-	struct Mesh *me = (mmd->object) ? mmd->object->data : NULL;
-	BMEditMesh *em = me ? me->edit_btmesh : NULL;
 	DerivedMesh *tmpdm, *cagedm;
 	MDeformVert *dvert = NULL;
 	MDefInfluence *influences;
@@ -201,8 +200,18 @@ static void meshdeformModifier_do(
 	if (!mmd->object || (!mmd->bindcagecos && !mmd->bindfunc))
 		return;
 
-	/* get cage derivedmesh */
-	if (em) {
+	/* Get cage derivedmesh.
+	 *
+	 * Only do this is the target object is in edit mode by itself, meaning
+	 * we don't allow linked edit meshes here.
+	 * This is because editbmesh_get_derived_cage_and_final() might easily
+	 * conflict with the thread which evaluates object which is in the edit
+	 * mode for this mesh.
+	 *
+	 * We'll support this case once granular dependency graph is landed.
+	 */
+	if (mmd->object == md->scene->obedit) {
+		BMEditMesh *em = BKE_editmesh_from_object(mmd->object);
 		tmpdm = editbmesh_get_derived_cage_and_final(md->scene, mmd->object, em, &cagedm, 0);
 		if (tmpdm)
 			tmpdm->release(tmpdm);




More information about the Bf-blender-cvs mailing list