diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2012-05-20 15:06:46 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2012-05-20 15:06:46 +0400 |
commit | c464654f5ea92c83ff5eac6577cfbf453b9f2674 (patch) | |
tree | 1577f3329f5042e8a5ad356b43fb7ebc2703f7e7 /source/blender/editors | |
parent | 1e33cc4384deb200654bf6b74f972bfb2da02989 (diff) |
Fix memory leak when trying to apply transformations to shared meshes
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_transform.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 2e21fe9cdfe..07557d8ea4c 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -382,7 +382,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo 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 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo 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 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo 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) { |