diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-10-03 11:06:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-10-03 11:06:56 +0400 |
commit | 5b5bc633960727279ebeaad2d1a48093f71c3984 (patch) | |
tree | 872f25987963d38ecbcf509b55ed662bb6503844 /source/blender/bmesh/tools | |
parent | 4cb4dc8432922413e40e0b8b93dc06e5710693de (diff) |
fix [#36923] Merge / Delete vertices crashes for some meshes
add BM_ITER_MESH_MUTABLE which steps before entering the for() loop body and prevents the assert from complaining about removing mesh data while iterating as well as the crash.
this was done in quite a few areas, more may turn up.
Diffstat (limited to 'source/blender/bmesh/tools')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 9db751ad1b7..8c3edfa23c4 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -2375,7 +2375,7 @@ void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, const struct MDeformVert *dvert, const int vertex_group) { BMIter iter; - BMVert *v; + BMVert *v, *v_next; BMEdge *e; BevelParams bp = {NULL}; @@ -2418,7 +2418,7 @@ void BM_mesh_bevel(BMesh *bm, const float offset, const float segments, } } - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { + BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_TAG)) { BLI_assert(find_bevvert(&bp, v) != NULL); BM_vert_kill(bm, v); diff --git a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c index bc9288f98f6..868caa49ec7 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c +++ b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c @@ -197,7 +197,7 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool } for (iter_step = 0; iter_step < iterations; iter_step++) { - BMVert *v; + BMVert *v, *v_next; bool iter_done; BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { @@ -318,7 +318,7 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool /* now we tagged all verts -1 for removal, lets loop over and rebuild faces */ iter_done = false; - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { + BM_ITER_MESH_MUTABLE (v, v_next, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_index_get(v) == VERT_INDEX_DO_COLLAPSE) { if (bm_vert_dissolve_fan(bm, v)) { iter_done = true; |