Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-04-11 16:29:29 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-04-11 16:29:29 +0400
commita02937d86ccb30f0cc08ef451634595fb45726c6 (patch)
tree888b31961f3bb2fbdae144bbc35e89779a775cdb /source
parent716f40018286fbeeb02a736b4f5f39dffca0b1e9 (diff)
Fix for bug #8920: particles reactor crash and memory leak.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/particle.c3
-rw-r--r--source/blender/blenkernel/intern/particle_system.c8
-rw-r--r--source/blender/blenlib/intern/fileops.c12
-rw-r--r--source/blender/src/buttons_object.c14
4 files changed, 28 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index c64b5fdceaf..9aa866eaf13 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -370,6 +370,9 @@ void psys_free(Object *ob, ParticleSystem * psys)
psys->part=0;
}
+ if(psys->reactevents.first)
+ BLI_freelistN(&psys->reactevents);
+
if(psys->pointcache)
BKE_ptcache_free(psys->pointcache);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index cd0d6b5d113..ebde51d4c3d 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -143,6 +143,9 @@ void psys_reset(ParticleSystem *psys, int mode)
psys->totpart= 0;
psys->totkeyed= 0;
psys->flag &= ~(PSYS_HAIR_DONE|PSYS_KEYED);
+
+ if(psys->reactevents.first)
+ BLI_freelistN(&psys->reactevents);
}
}
@@ -1701,7 +1704,10 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi
/*TODO: get precise location of particle at birth*/
state.time=cfra;
- psys_get_particle_state(tob,tpsys,pa->num,&state,1);
+ if(pa->num == -1)
+ memset(&state, 0, sizeof(state));
+ else
+ psys_get_particle_state(tob,tpsys,pa->num,&state,1);
psys_get_from_key(&state,loc,nor,rot,0);
QuatMulVecf(rot,vtan);
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index a9da0c9c738..268f9280bea 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -331,11 +331,15 @@ int BLI_delete(char *file, int dir, int recursive)
printf("Error: not deleted file %s because of quote!\n", file);
}
else {
- if (recursive) sprintf(str, "/bin/rm -rf \"%s\"", file);
- else if (dir) sprintf(str, "/bin/rmdir \"%s\"", file);
+ if (recursive) {
+ sprintf(str, "/bin/rm -rf \"%s\"", file);
+ return system(str);
+ }
+ else if (dir) {
+ sprintf(str, "/bin/rmdir \"%s\"", file);
+ return system(str);
+ }
else remove(file); //sprintf(str, "/bin/rm -f \"%s\"", file);
-
- return system(str);
}
return -1;
}
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 88232d7a14a..652ad7cac05 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -2204,10 +2204,13 @@ void pointcache_free(PTCacheID *pid, int cacheonly)
ListBase pidlist;
if(pid) {
- if(cacheonly)
+ if(cacheonly) {
BKE_ptcache_id_reset(pid, PTCACHE_RESET_DEPSGRAPH);
- else
+ }
+ else {
BKE_ptcache_id_reset(pid, PTCACHE_RESET_BAKED);
+ pid->cache->flag &= ~PTCACHE_BAKED;
+ }
DAG_object_flush_update(G.scene, pid->ob, OB_RECALC_DATA);
}
@@ -2217,10 +2220,13 @@ void pointcache_free(PTCacheID *pid, int cacheonly)
BKE_ptcache_ids_from_object(&pidlist, base->object);
for(pid=pidlist.first; pid; pid=pid->next) {
- if(cacheonly)
+ if(cacheonly) {
BKE_ptcache_id_reset(pid, PTCACHE_RESET_DEPSGRAPH);
- else
+ }
+ else {
BKE_ptcache_id_reset(pid, PTCACHE_RESET_BAKED);
+ pid->cache->flag &= ~PTCACHE_BAKED;
+ }
DAG_object_flush_update(G.scene, pid->ob, OB_RECALC_DATA);
}