[Bf-blender-cvs] [948ad8e88b9] fracture_modifier: crash fix and attempt to reduce unnecessary memory usage

Martin Felke noreply at git.blender.org
Sun Jun 4 00:55:31 CEST 2017


Commit: 948ad8e88b9d61024f237a06c83868d8659c286e
Author: Martin Felke
Date:   Sun Jun 4 00:55:19 2017 +0200
Branches: fracture_modifier
https://developer.blender.org/rB948ad8e88b9d61024f237a06c83868d8659c286e

crash fix and attempt to reduce unnecessary memory usage

===================================================================

M	source/blender/blenkernel/intern/rigidbody.c
M	source/blender/blenloader/intern/writefile.c

===================================================================

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 13f13e5c854..d4f8aa2f7f0 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -4176,7 +4176,7 @@ static void rigidbody_update_simulation(Scene *scene, RigidBodyWorld *rbw, bool
 			did_modifier = do_update_modifier(scene, ob, rbw, rebuild);
 		}
 
-		if (!did_modifier) {
+		if (!did_modifier && ob->type == OB_MESH) {
 			/* validate that we've got valid object set up here... */
 			RigidBodyOb *rbo = ob->rigidbody_object;
 			/* update transformation matrix of the object so we don't get a frame of lag for simple animations */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index f01ed46423d..aa79044c5d4 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1746,6 +1746,16 @@ static void write_meshIsland(WriteData* wd, MeshIsland* mi, bool write_data)
 		writedata(wd, DATA, sizeof(float) * 4 * mi->frame_count, mi->rots);
 	}
 	else {
+		if (mi->locs) {
+			MEM_freeN(mi->locs);
+			mi->locs = NULL;
+		}
+
+		if (mi->rots) {
+			MEM_freeN(mi->rots);
+			mi->rots = NULL;
+		}
+
 		mi->frame_count = 0;
 	}




More information about the Bf-blender-cvs mailing list