diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-24 14:04:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-25 00:53:09 +0400 |
commit | 25835ec977cbb255c01699ae3bd38f93668ff024 (patch) | |
tree | 6b4bb1051f960d00e0f75958df3aaa9890677654 | |
parent | 76d32a3f1646aa82ea90de974a4ab800cb746a30 (diff) |
Fix possible use of invalid face index with wireframe tool
-rw-r--r-- | source/blender/bmesh/tools/bmesh_wireframe.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/bmesh/tools/bmesh_wireframe.c b/source/blender/bmesh/tools/bmesh_wireframe.c index db4601d6134..0cb3aa51ccd 100644 --- a/source/blender/bmesh/tools/bmesh_wireframe.c +++ b/source/blender/bmesh/tools/bmesh_wireframe.c @@ -227,16 +227,18 @@ void BM_mesh_wireframe( cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE); } - BM_mesh_elem_index_ensure(bm, BM_VERT); - BM_ITER_MESH_INDEX (v_src, &iter, bm, BM_VERTS_OF_MESH, i) { - BM_elem_flag_disable(v_src, BM_ELEM_TAG); + BM_elem_index_set(v_src, i); /* set_inline */ + verts_src[i] = v_src; + BM_elem_flag_disable(v_src, BM_ELEM_TAG); } + bm->elem_index_dirty &= ~BM_VERT; /* setup tags, all faces and verts will be tagged which will be duplicated */ - BM_ITER_MESH (f_src, &iter, bm, BM_FACES_OF_MESH) { + BM_ITER_MESH_INDEX (f_src, &iter, bm, BM_FACES_OF_MESH, i) { + BM_elem_index_set(f_src, i); /* set_inline */ if (use_tag) { if (!BM_elem_flag_test(f_src, BM_ELEM_TAG)) { @@ -256,6 +258,7 @@ void BM_mesh_wireframe( BM_elem_flag_set(l->e, BM_ELEM_TAG, bm_loop_is_radial_boundary(l)); } } + bm->elem_index_dirty &= ~BM_FACE; /* duplicate tagged verts */ for (i = 0; i < totvert_orig; i++) { |