Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-05-07 01:31:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-05-07 01:31:16 +0400
commit730ca20c6324b0761846fbd623ecd39bc5573412 (patch)
tree5ae734a89da7119a8960454997415af4f117c684 /source
parent9610515b22dcf0450aca9c3794700380851753a9 (diff)
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().
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/object.c3
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c10
2 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index baa1caee49b..24c23e5ea41 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1140,12 +1140,13 @@ ParticleSystem *copy_particlesystem(ParticleSystem *psys)
}
BLI_duplicatelist(&psysn->targets, &psys->targets);
-
+
psysn->pathcache= NULL;
psysn->childcache= NULL;
psysn->edit= NULL;
psysn->frand= NULL;
psysn->pdd= NULL;
+ psysn->effectors= NULL;
psysn->pathcachebufs.first = psysn->pathcachebufs.last = NULL;
psysn->childcachebufs.first = psysn->childcachebufs.last = NULL;
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);