[Bf-blender-cvs] [9285bbe] master: Fix error splitting convex faces

Campbell Barton noreply at git.blender.org
Wed Jun 15 20:46:00 CEST 2016


Commit: 9285bbe48430f2bf3534bc23a35b95d94bc2674c
Author: Campbell Barton
Date:   Thu Jun 16 03:43:22 2016 +1000
Branches: master
https://developer.blender.org/rB9285bbe48430f2bf3534bc23a35b95d94bc2674c

Fix error splitting convex faces

Created double faces, leaked memory.

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

M	source/blender/bmesh/operators/bmo_connect_concave.c

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

diff --git a/source/blender/bmesh/operators/bmo_connect_concave.c b/source/blender/bmesh/operators/bmo_connect_concave.c
index 34f59aa..8b9c60a 100644
--- a/source/blender/bmesh/operators/bmo_connect_concave.c
+++ b/source/blender/bmesh/operators/bmo_connect_concave.c
@@ -85,7 +85,7 @@ static bool bm_face_split_by_concave(
 	BMFace  **faces_array = BLI_array_alloca(faces_array, faces_array_tot);
 	BMEdge  **edges_array = BLI_array_alloca(edges_array, edges_array_tot);
 	const int quad_method = 0, ngon_method = 0;  /* beauty */
-	LinkNode *r_faces_double = NULL;
+	LinkNode *faces_double = NULL;
 
 	float normal[3];
 	BLI_assert(f_base->len > 3);
@@ -96,7 +96,7 @@ static bool bm_face_split_by_concave(
 	        bm, f_base,
 	        faces_array, &faces_array_tot,
 	        edges_array, &edges_array_tot,
-	        &r_faces_double,
+	        &faces_double,
 	        quad_method, ngon_method, false,
 	        pf_arena,
 	        pf_heap, pf_ehash);
@@ -163,6 +163,13 @@ static bool bm_face_split_by_concave(
 	BLI_heap_clear(pf_heap, NULL);
 	BLI_edgehash_clear_ex(pf_ehash, NULL, BLI_POLYFILL_ALLOC_NGON_RESERVE);
 
+	while (faces_double) {
+		LinkNode *next = faces_double->next;
+		BM_face_kill(bm, faces_double->link);
+		MEM_freeN(faces_double);
+		faces_double = next;
+	}
+
 	return true;
 }




More information about the Bf-blender-cvs mailing list