diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 205159c94a1..4f8536e8962 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -229,9 +229,10 @@ void pbvh_grow_nodes(PBVH *bvh, int totnode) bvh->node_mem_count *= 1.33; if (bvh->node_mem_count < totnode) bvh->node_mem_count = totnode; - bvh->nodes = MEM_callocN(sizeof(PBVHNode) * bvh->node_mem_count, + bvh->nodes = MEM_mallocN(sizeof(PBVHNode) * bvh->node_mem_count, "bvh nodes"); memcpy(bvh->nodes, prev, bvh->totnode * sizeof(PBVHNode)); + memset(bvh->nodes + bvh->totnode, 0, (bvh->node_mem_count - bvh->totnode) * sizeof(PBVHNode)); MEM_freeN(prev); } diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index c9b68931142..bc2a47a540b 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -365,7 +365,6 @@ static void pbvh_bmesh_vert_ownership_transfer(PBVH *bvh, PBVHNode *new_owner, BLI_assert(current_owner != new_owner); /* Remove current ownership */ - // BLI_ghash_remove(bvh->bm_vert_to_node, v, NULL, NULL); // assign handles below BLI_ghash_remove(current_owner->bm_unique_verts, v, NULL, NULL); /* Set new ownership */ @@ -384,7 +383,6 @@ static void pbvh_bmesh_vert_remove(PBVH *bvh, BMVert *v) BLI_assert(BLI_ghash_haskey(bvh->bm_vert_to_node, v)); v_node = pbvh_bmesh_node_lookup(bvh, bvh->bm_vert_to_node, v); - BLI_ghash_remove(bvh->bm_vert_to_node, v, NULL, NULL); BLI_ghash_remove(v_node->bm_unique_verts, v, NULL, NULL); BLI_ghash_remove(bvh->bm_vert_to_node, v, NULL, NULL); @@ -1036,7 +1034,7 @@ void pbvh_bmesh_normals_update(PBVHNode **nodes, int totnode) } /* This should be unneeded normally */ GHASH_ITER (gh_iter, node->bm_other_verts) { - BM_vert_normal_update(BLI_ghashIterator_getKey(&gh_iter)); + BM_vert_normal_update(BLI_ghashIterator_getKey(&gh_iter)); } node->flag &= ~PBVH_UpdateNormals; }