diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-22 14:50:06 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-12-22 14:51:00 +0300 |
commit | 870840e8b7dd8860691de0910ade3f0d0f217f14 (patch) | |
tree | 921eae1cbc72046a9dbe4e0254e9785a67352691 /source | |
parent | df0ecd73af9218608b5436761d6a298cb4985709 (diff) |
Subsurf: Avoid possible use of partially initialized edge hash
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 1386c23e234..ecb0f76fd62 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1492,13 +1492,16 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop) BLI_rw_mutex_lock(&ccgdm->loops_cache_rwlock, THREAD_LOCK_WRITE); if (!ccgdm->ehash) { MEdge *medge; + EdgeHash *ehash; - ccgdm->ehash = BLI_edgehash_new_ex(__func__, ccgdm->dm.numEdgeData); + ehash = BLI_edgehash_new_ex(__func__, ccgdm->dm.numEdgeData); medge = ccgdm->dm.getEdgeArray((DerivedMesh *)ccgdm); for (i = 0; i < ccgdm->dm.numEdgeData; i++) { - BLI_edgehash_insert(ccgdm->ehash, medge[i].v1, medge[i].v2, SET_INT_IN_POINTER(i)); + BLI_edgehash_insert(ehash, medge[i].v1, medge[i].v2, SET_INT_IN_POINTER(i)); } + + atomic_cas_ptr((void**)&ccgdm->ehash, ccgdm->ehash, ehash); } BLI_rw_mutex_unlock(&ccgdm->loops_cache_rwlock); } |