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/bmesh_decimate_unsubdivide.c | |
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/bmesh_decimate_unsubdivide.c')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; |