[Bf-blender-cvs] [72151f3e36b] blender-v2.79a-release: Subsurf: Avoid possible use of partially initialized edge hash

Sergey Sharybin noreply at git.blender.org
Tue Jan 9 14:17:25 CET 2018


Commit: 72151f3e36b2e20418734c7e61aa09e0112cbaac
Author: Sergey Sharybin
Date:   Fri Dec 22 12:50:06 2017 +0100
Branches: blender-v2.79a-release
https://developer.blender.org/rB72151f3e36b2e20418734c7e61aa09e0112cbaac

Subsurf: Avoid possible use of partially initialized edge hash

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

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

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

diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 6f2b755f0cd..f58fa9cc8fd 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1490,13 +1490,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);
 	}



More information about the Bf-blender-cvs mailing list