[Bf-blender-cvs] [29d9140] master: Fix T46804: Crash using triangulate modifier on a specific mesh.

Bastien Montagne noreply at git.blender.org
Thu Nov 19 22:02:36 CET 2015


Commit: 29d9140fcee26b9c1df31022294f5f6f89f5dbeb
Author: Bastien Montagne
Date:   Thu Nov 19 22:00:07 2015 +0100
Branches: master
https://developer.blender.org/rB29d9140fcee26b9c1df31022294f5f6f89f5dbeb

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.

===================================================================

M	source/blender/bmesh/intern/bmesh_polygon.c

===================================================================

diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 0465148..1b1b133 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);
 			}




More information about the Bf-blender-cvs mailing list