[Bf-blender-cvs] [00dc066] master: Fix T49608: runtime-only particle's boid->ground Object pointer was left dangling to invalid value in read code...

Bastien Montagne noreply at git.blender.org
Sat Oct 8 15:20:54 CEST 2016


Commit: 00dc0666b3fedfbb24aef0e636a3227746e465f2
Author: Bastien Montagne
Date:   Sat Oct 8 15:18:35 2016 +0200
Branches: master
https://developer.blender.org/rB00dc0666b3fedfbb24aef0e636a3227746e465f2

Fix T49608: runtime-only particle's boid->ground Object pointer was left dangling to invalid value in read code...

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

M	source/blender/blenloader/intern/readfile.c

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 139cb84..e3b06b0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4277,12 +4277,14 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
 			
 			psys->flag &= ~PSYS_KEYED;
 		}
-		
+
 		if (psys->particles && psys->particles->boid) {
 			pa = psys->particles;
 			pa->boid = newdataadr(fd, pa->boid);
-			for (a=1, pa++; a<psys->totpart; a++, pa++)
-				pa->boid = (pa-1)->boid + 1;
+			for (a = 1, pa++; a < psys->totpart; a++, pa++) {
+				pa->boid = (pa - 1)->boid + 1;
+				pa->boid->ground = NULL;  /* This is purely runtime data, but still can be an issue if left dangling. */
+			}
 		}
 		else if (psys->particles) {
 			for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++)




More information about the Bf-blender-cvs mailing list