[Bf-blender-cvs] [0610c09f8c0] blender2.8: Fix memleak on snap_curs_to_sel_ex

Dalai Felinto noreply at git.blender.org
Fri Aug 31 21:26:51 CEST 2018


Commit: 0610c09f8c0e8188abdf377d8b6fd36be012ed0a
Author: Dalai Felinto
Date:   Fri Aug 31 16:23:38 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB0610c09f8c0e8188abdf377d8b6fd36be012ed0a

Fix memleak on snap_curs_to_sel_ex

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

M	source/blender/editors/space_view3d/view3d_snap.c

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

diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 84474136396..484eb38297b 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -621,21 +621,21 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
 			}
 
 			global_transverts_tot += tvs.transverts_tot;
-			if (global_transverts_tot == 0) {
-				continue;
-			}
+			if (global_transverts_tot != 0) {
 
-			Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit);
-			copy_m3_m4(bmat, obedit_eval->obmat);
+				Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit);
+				copy_m3_m4(bmat, obedit_eval->obmat);
 
-			tv = tvs.transverts;
-			for (a = 0; a < tvs.transverts_tot; a++, tv++) {
-				copy_v3_v3(vec, tv->loc);
-				mul_m3_v3(bmat, vec);
-				add_v3_v3(vec, obedit_eval->obmat[3]);
-				add_v3_v3(centroid, vec);
-				minmax_v3v3_v3(min, max, vec);
+				tv = tvs.transverts;
+				for (a = 0; a < tvs.transverts_tot; a++, tv++) {
+					copy_v3_v3(vec, tv->loc);
+					mul_m3_v3(bmat, vec);
+					add_v3_v3(vec, obedit_eval->obmat[3]);
+					add_v3_v3(centroid, vec);
+					minmax_v3v3_v3(min, max, vec);
+				}
 			}
+			ED_transverts_free(&tvs);
 		}
 		MEM_freeN(objects);
 
@@ -646,8 +646,6 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
 		else {
 			mid_v3_v3v3(cursor, min, max);
 		}
-
-		ED_transverts_free(&tvs);
 	}
 	else {
 		Object *obact = CTX_data_active_object(C);



More information about the Bf-blender-cvs mailing list