Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2017-09-19 14:57:46 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-09-19 15:00:49 +0300
commit9591b5f6182f754dc06e1aff43d6b8b675aa9bf4 (patch)
treedb965171bdf3b832c171995de65028b95b3263b5 /source/blender/blenkernel/intern/cdderivedmesh.c
parent1a4442b3dbadd685b9c6a70fa9694748b2a6e2d3 (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/cdderivedmesh.c')
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 0d59357a168..47e1f0beb31 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1919,12 +1919,16 @@ void CDDM_recalc_looptri(DerivedMesh *dm)
const unsigned int totloop = dm->numLoopData;
DM_ensure_looptri_data(dm);
+ BLI_assert(cddm->dm.looptris.array_wip != NULL);
BKE_mesh_recalc_looptri(
cddm->mloop, cddm->mpoly,
cddm->mvert,
totloop, totpoly,
- cddm->dm.looptris.array);
+ cddm->dm.looptris.array_wip);
+
+ BLI_assert(cddm->dm.looptris.array == NULL);
+ SWAP(MLoopTri *, cddm->dm.looptris.array, cddm->dm.looptris.array_wip);
}
static void cdDM_free_internal(CDDerivedMesh *cddm)