[Bf-blender-cvs] [680b135] master: Fix T48176: Shrinkwrap crashes when multiple objects uses same target

Sergey Sharybin noreply at git.blender.org
Tue Apr 26 14:44:44 CEST 2016


Commit: 680b135ec1cf220c7ebd579b88bc5481fc379fc3
Author: Sergey Sharybin
Date:   Tue Apr 26 14:42:58 2016 +0200
Branches: master
https://developer.blender.org/rB680b135ec1cf220c7ebd579b88bc5481fc379fc3

Fix T48176: Shrinkwrap crashes when multiple objects uses same target

Annoying bug caused by temp nature of looptri layer for CCGDM.

Fixed in a similar to CCG loops by using lock when allocating and
filling looptri arrays.

Real fix would be to make sure this array is allocated on object
evaluation using DAG's eval_flag, but that's more involved change
which we'll work on later.

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

M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenkernel/intern/subsurf_ccg.c

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

diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index dabe606..1b9ac49 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3523,8 +3523,6 @@ static void shrinkwrap_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstra
 			
 			free_bvhtree_from_mesh(&treeData);
 			
-			target->release(target);
-			
 			if (fail == true) {
 				/* Don't move the point */
 				zero_v3(co);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index daa667f..a84b835 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -4365,6 +4365,7 @@ static void ccgDM_recalcLoopTri(DerivedMesh *UNUSED(dm))
 
 static const MLoopTri *ccgDM_getLoopTriArray(DerivedMesh *dm)
 {
+	BLI_rw_mutex_lock(&loops_cache_rwlock, THREAD_LOCK_WRITE);
 	if (dm->looptris.array) {
 		BLI_assert(poly_to_tri_count(dm->numPolyData, dm->numLoopData) == dm->looptris.num);
 	}
@@ -4395,6 +4396,7 @@ static const MLoopTri *ccgDM_getLoopTriArray(DerivedMesh *dm)
 			lt->poly = poly_index;
 		}
 	}
+	BLI_rw_mutex_unlock(&loops_cache_rwlock);
 	return dm->looptris.array;
 }




More information about the Bf-blender-cvs mailing list