[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40897] branches/bmesh/blender/source/ blender: Some bevel fixes: fix a crash BM_Copy_Attributes when source== target, and fix a memory leak from not cleaning up em-> emcopy after calling bevel bmop

Andrew Wiggin ender79bl at gmail.com
Mon Oct 10 09:21:06 CEST 2011


Revision: 40897
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40897
Author:   ender79
Date:     2011-10-10 07:21:05 +0000 (Mon, 10 Oct 2011)
Log Message:
-----------
Some bevel fixes: fix a crash BM_Copy_Attributes when source==target, and fix a memory leak from not cleaning up em->emcopy after calling bevel bmop

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c	2011-10-10 07:10:53 UTC (rev 40896)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_construct.c	2011-10-10 07:21:05 UTC (rev 40897)
@@ -429,6 +429,9 @@
 
 static void bm_copy_vert_attributes(BMesh *source_mesh, BMesh *target_mesh, const BMVert *source_vertex, BMVert *target_vertex)
 {
+	if ((source_mesh == target_mesh) && (source_vertex == target_vertex)) {
+		return;
+	}
 	copy_v3_v3(target_vertex->no, source_vertex->no);
 	CustomData_bmesh_free_block(&target_mesh->vdata, &target_vertex->head.data);
 	CustomData_bmesh_copy_data(&source_mesh->vdata, &target_mesh->vdata, source_vertex->head.data, &target_vertex->head.data);	
@@ -436,18 +439,27 @@
 
 static void bm_copy_edge_attributes(BMesh *source_mesh, BMesh *target_mesh, const BMEdge *source_edge, BMEdge *target_edge)
 {
+	if ((source_mesh == target_mesh) && (source_edge == target_edge)) {
+		return;
+	}
 	CustomData_bmesh_free_block(&target_mesh->edata, &target_edge->head.data);
 	CustomData_bmesh_copy_data(&source_mesh->edata, &target_mesh->edata, source_edge->head.data, &target_edge->head.data);
 }
 
 static void bm_copy_loop_attributes(BMesh *source_mesh, BMesh *target_mesh, const BMLoop *source_loop, BMLoop *target_loop)
 {
+	if ((source_mesh == target_mesh) && (source_loop == target_loop)) {
+		return;
+	}
 	CustomData_bmesh_free_block(&target_mesh->ldata, &target_loop->head.data);
 	CustomData_bmesh_copy_data(&source_mesh->ldata, &target_mesh->ldata, source_loop->head.data, &target_loop->head.data);
 }
 
 static void bm_copy_face_attributes(BMesh *source_mesh, BMesh *target_mesh, const BMFace *source_face, BMFace *target_face)
 {
+	if ((source_mesh == target_mesh) && (source_face == target_face)) {
+		return;
+	}
 	copy_v3_v3(target_face->no, source_face->no);
 	CustomData_bmesh_free_block(&target_mesh->pdata, &target_face->head.data);
 	CustomData_bmesh_copy_data(&source_mesh->pdata, &target_mesh->pdata, source_face->head.data, &target_face->head.data);	

Modified: branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c	2011-10-10 07:10:53 UTC (rev 40896)
+++ branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c	2011-10-10 07:21:05 UTC (rev 40897)
@@ -4793,7 +4793,8 @@
 			return OPERATOR_CANCELLED;
 		
 		BMO_Exec_Op(em->bm, &bmop);
-		BMO_Finish_Op(em->bm, &bmop);
+		if (!EDBM_FinishOp(em, &bmop, op, 1))
+			return OPERATOR_CANCELLED;
 	}
 	
 	BM_free_data_layer_n(em->bm, &em->bm->edata, CD_MASK_PROP_FLT, li);




More information about the Bf-blender-cvs mailing list