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.
This commit is contained in:
Bastien Montagne 2015-11-19 22:00:07 +01:00
parent c7c3f09269
commit 29d9140fce
Notes: blender-bot 2023-02-14 08:25:20 +01:00
Referenced by issue #46804, Crash when using Triangulate modifier on a specific mesh.
1 changed files with 7 additions and 1 deletions

View File

@ -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);
}