From 730ca20c6324b0761846fbd623ecd39bc5573412 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 May 2010 21:31:16 +0000 Subject: fix for duplicating cloth which could crash on freeing - effector list wasnt NULL'd on copying a particle system - copying an object would initialize the cloth modifier, then copy it, witout freeing its effector weights created in cloth_init(). --- source/blender/modifiers/intern/MOD_cloth.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_cloth.c') diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 865157ce585..5050333cd43 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -123,15 +123,19 @@ static void copyData(ModifierData *md, ModifierData *target) { ClothModifierData *clmd = (ClothModifierData*) md; ClothModifierData *tclmd = (ClothModifierData*) target; - - if(tclmd->sim_parms) + + if(tclmd->sim_parms) { + if(tclmd->sim_parms->effector_weights) + MEM_freeN(tclmd->sim_parms->effector_weights); MEM_freeN(tclmd->sim_parms); + } + if(tclmd->coll_parms) MEM_freeN(tclmd->coll_parms); BKE_ptcache_free_list(&tclmd->ptcaches); tclmd->point_cache = NULL; - + tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms); if(clmd->sim_parms->effector_weights) tclmd->sim_parms->effector_weights = MEM_dupallocN(clmd->sim_parms->effector_weights); -- cgit v1.2.3