diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-20 00:00:07 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-20 00:02:22 +0300 |
commit | 29d9140fcee26b9c1df31022294f5f6f89f5dbeb (patch) | |
tree | 14b1f2d8e98d15aef39ca80e9bd7f121e6f0a0f6 | |
parent | c7c3f0926904af370f2599e3319a0b1453b09433 (diff) |
Fix T46804: Crash using triangulate modifier on a specific mesh.
Issues was again the ugly hack of swapping last generated tri with original face
we use in BMesh triangulate code - here it could lead in some rare case to have
invalid face pointer in doubles list.
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 0465148fd88..1b1b1332b5d 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -941,7 +941,13 @@ void BM_face_triangulate( BMLoop *l_iter = l_new->radial_next; do { if (UNLIKELY(l_new->prev->v == l_iter->prev->v)) { - BLI_linklist_prepend(r_faces_double, l_new->f); + if (UNLIKELY(i == last_tri)) { + /* Because we swap last f_new with f at the end... */ + BLI_linklist_prepend(r_faces_double, f); + } + else { + BLI_linklist_prepend(r_faces_double, f_new); + } } } while ((l_iter = l_iter->radial_next) != l_new); } |