[Bf-blender-cvs] [298bf5a] 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 9 14:25:22 CET 2015


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

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