[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28630] trunk/blender/source/blender: fix for duplicating cloth which could crash on freeing

Campbell Barton ideasman42 at gmail.com
Thu May 6 23:31:18 CEST 2010


Revision: 28630
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28630
Author:   campbellbarton
Date:     2010-05-06 23:31:16 +0200 (Thu, 06 May 2010)

Log Message:
-----------
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().

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/object.c
    trunk/blender/source/blender/modifiers/intern/MOD_cloth.c

Modified: trunk/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/object.c	2010-05-06 20:10:37 UTC (rev 28629)
+++ trunk/blender/source/blender/blenkernel/intern/object.c	2010-05-06 21:31:16 UTC (rev 28630)
@@ -1140,12 +1140,13 @@
 	}
 
 	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;

Modified: trunk/blender/source/blender/modifiers/intern/MOD_cloth.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_cloth.c	2010-05-06 20:10:37 UTC (rev 28629)
+++ trunk/blender/source/blender/modifiers/intern/MOD_cloth.c	2010-05-06 21:31:16 UTC (rev 28630)
@@ -123,15 +123,19 @@
 {
 	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);





More information about the Bf-blender-cvs mailing list