[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46802] trunk/blender/source/blender/ editors/object/object_transform.c: Fix memory leak when trying to apply transformations to shared meshes

Antony Riakiotakis kalast at gmail.com
Sun May 20 13:06:47 CEST 2012


Revision: 46802
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46802
Author:   psy-fi
Date:     2012-05-20 11:06:46 +0000 (Sun, 20 May 2012)
Log Message:
-----------
Fix memory leak when trying to apply transformations to shared meshes

Modified Paths:
--------------
    trunk/blender/source/blender/editors/object/object_transform.c

Modified: trunk/blender/source/blender/editors/object/object_transform.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_transform.c	2012-05-20 00:34:54 UTC (rev 46801)
+++ trunk/blender/source/blender/editors/object/object_transform.c	2012-05-20 11:06:46 UTC (rev 46802)
@@ -382,7 +382,7 @@
 	Main *bmain = CTX_data_main(C);
 	Scene *scene = CTX_data_scene(C);
 	float rsmat[3][3], tmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale;
-	int a, change = 0;
+	int a, change = 1;
 	
 	/* first check if we can execute */
 	CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
@@ -391,19 +391,19 @@
 		if (ob->type == OB_MESH) {
 			if (ID_REAL_USERS(ob->data) > 1) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user mesh, doing nothing");
-				return OPERATOR_CANCELLED;
+				change = 0;
 			}
 		}
 		else if (ob->type == OB_ARMATURE) {
 			if (ID_REAL_USERS(ob->data) > 1) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user armature, doing nothing");
-				return OPERATOR_CANCELLED;
+				change = 0;
 			}
 		}
 		else if (ob->type == OB_LATTICE) {
 			if (ID_REAL_USERS(ob->data) > 1) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user lattice, doing nothing");
-				return OPERATOR_CANCELLED;
+				change = 0;
 			}
 		}
 		else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
@@ -411,23 +411,28 @@
 
 			if (ID_REAL_USERS(ob->data) > 1) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user curve, doing nothing");
-				return OPERATOR_CANCELLED;
+				change = 0;
 			}
 
 			cu = ob->data;
 
 			if (!(cu->flag & CU_3D) && (apply_rot || apply_loc)) {
 				BKE_report(reports, RPT_ERROR, "Neither rotation nor location could be applied to a 2d curve, doing nothing");
-				return OPERATOR_CANCELLED;
+				change = 0;
 			}
 			if (cu->key) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a curve with vertex keys, doing nothing");
-				return OPERATOR_CANCELLED;
+				change = 0;
 			}
 		}
 	}
 	CTX_DATA_END;
 	
+	if (!change)
+		return OPERATOR_CANCELLED;
+
+	change = 0;
+
 	/* now execute */
 	CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
 	{




More information about the Bf-blender-cvs mailing list