Subsurf: Avoid possible use of partially initialized edge hash

This commit is contained in:
Sergey Sharybin 2017-12-22 12:50:06 +01:00
parent df0ecd73af
commit 870840e8b7
Notes: blender-bot 2023-02-14 06:17:19 +01:00
Referenced by issue #53683, 2.79a release
1 changed files with 5 additions and 2 deletions

View File

@ -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);
}