[Bf-blender-cvs] [cb7f62a] temp_hair_modifiers: Fix for unfreed duplicated hair key arrays when the number of hair keys stays the same.

Lukas Tönne noreply at git.blender.org
Mon Feb 2 16:11:45 CET 2015


Commit: cb7f62ab47e8e5e21ae3b18c105cc35a24b5a3fc
Author: Lukas Tönne
Date:   Mon Feb 2 15:06:57 2015 +0100
Branches: temp_hair_modifiers
https://developer.blender.org/rBcb7f62ab47e8e5e21ae3b18c105cc35a24b5a3fc

Fix for unfreed duplicated hair key arrays when the number of hair keys
stays the same.

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

M	source/blender/blenkernel/intern/particle_system.c

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

diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 0742fd8..216b6e0 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -2891,11 +2891,16 @@ static void psys_hair_final_reset(ParticleSimulationData *sim)
 				MEM_freeN(pa->hair_final);
 			pa->hair_final = NULL;
 			pa->totkey_final = 0;
+			
+			if (pa->hair) {
+				pa->hair_final = MEM_dupallocN(pa->hair);
+				pa->totkey_final = pa->totkey;
+			}
 		}
-		
-		if (pa->hair) {
-			pa->hair_final = MEM_dupallocN(pa->hair);
-			pa->totkey_final = pa->totkey;
+		else {
+			if (pa->hair && pa->hair_final) {
+				memcpy(pa->hair_final, pa->hair, sizeof(HairKey) * pa->totkey);
+			}
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list