From 9591b5f6182f754dc06e1aff43d6b8b675aa9bf4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 19 Sep 2017 13:57:46 +0200 Subject: Fix T52816: regression can't open file in 2.79 (crash). Tentative fix, since I cannot reproduce thenissue for some reason here on linux. Core of the problem is pretty clear though, thanks to Germano Cavalcante (@mano-wii): another thread could try to use looptris data after worker one had allocated it, but before it had actually computed looptris. So now, we use a temp 'wip' pointer to store looptris being computed (since this is protected by a mutex, other threads will have to wait on it, no possibility for them to double-compute the looptris here). This should probably be backported to 2.79a if done. --- source/blender/blenkernel/BKE_DerivedMesh.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/BKE_DerivedMesh.h') diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index e2577689101..700bfe568f1 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -193,7 +193,9 @@ struct DerivedMesh { * \warning Typical access is done via #getLoopTriArray, #getNumLoopTri. */ struct { - struct MLoopTri *array; + /* WARNING! swapping between array (ready-to-be-used data) and array_wip (where data is actually computed) + * shall always be protected by same lock as one used for looptris computing. */ + struct MLoopTri *array, *array_wip; int num; int num_alloc; } looptris; -- cgit v1.2.3