diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-22 14:03:55 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-22 14:03:55 +0300 |
commit | cbc4aae06a9b3878b0af68884a75b953e3c8612b (patch) | |
tree | a78995019e14771bcca43c51a3f2d27cd9e2110e | |
parent | 00318eaa2eedfd0f1b8af12bd4a7f664b6ef1b89 (diff) |
Fix crash rendering grass_wind.blend from regression tests. The real
problem is that where_is_object is being called from multiple threads
but is not thread-safe, added a note about this problem, this commit
only solves the crash. Also remove the pushdata/popdata mechanism
that was being used here, using this kind of system is bound to give
problems with threading.
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 70 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 17 |
4 files changed, 9 insertions, 86 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 5d264be3adf..a4a8f254f1d 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -62,12 +62,6 @@ void BKE_userdef_free(void); void set_blender_test_break_cb(void (*func)(void) ); int blender_test_break(void); -void pushdata(void *data, int len); -void popfirst(void *data); -void poplast(void *data); -void free_pushpop(void); -void pushpop_test(void); - /* global undo */ extern void BKE_write_undo(struct bContext *C, char *name); extern void BKE_undo_step(struct bContext *C, int step); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 6181712f1be..226aa82a36a 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -103,76 +103,6 @@ short ENDIAN_ORDER; char versionstr[48]= ""; -/* ************************************************ */ -/* pushpop facility: to store data temporally, FIFO! */ - -ListBase ppmain={0, 0}; - -typedef struct PushPop { - struct PushPop *next, *prev; - void *data; - int len; -} PushPop; - -void pushdata(void *data, int len) -{ - PushPop *pp; - - pp= MEM_mallocN(sizeof(PushPop), "pushpop"); - BLI_addtail(&ppmain, pp); - pp->data= MEM_mallocN(len, "pushpop"); - pp->len= len; - memcpy(pp->data, data, len); -} - -void popfirst(void *data) -{ - PushPop *pp; - - pp= ppmain.first; - if(pp) { - memcpy(data, pp->data, pp->len); - BLI_remlink(&ppmain, pp); - MEM_freeN(pp->data); - MEM_freeN(pp); - } - else printf("error in popfirst\n"); -} - -void poplast(void *data) -{ - PushPop *pp; - - pp= ppmain.last; - if(pp) { - memcpy(data, pp->data, pp->len); - BLI_remlink(&ppmain, pp); - MEM_freeN(pp->data); - MEM_freeN(pp); - } - else printf("error in poplast\n"); -} - -void free_pushpop() -{ - PushPop *pp; - - pp= ppmain.first; - while(pp) { - BLI_remlink(&ppmain, pp); - MEM_freeN(pp->data); - MEM_freeN(pp); - } -} - -void pushpop_test() -{ - if(ppmain.first) printf("pushpop not empty\n"); - free_pushpop(); -} - - - /* ********** free ********** */ /* only to be called on exit blender */ diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 83f63c9ffb2..b261d3365af 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -658,6 +658,8 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin Object *ob = eff->ob; Object obcopy = *ob; + /* XXX this is not thread-safe, but used from multiple threads by + particle system */ where_is_object_time(eff->scene, ob, cfra); /* use z-axis as normal*/ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index fd4f98e0a17..1063fa85e1f 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1983,7 +1983,6 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) float *fp1, *fp2, slowmat[4][4] = MAT4_UNITY; float stime=ctime, fac1, fac2, vec[3]; int a; - int pop; /* new version: correct parent+vertexparent and track+parent */ /* this one only calculates direct attached parent and track */ @@ -2002,21 +2001,19 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) /* hurms, code below conflicts with depgraph... (ton) */ /* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */ - pop= 0; if(no_parent_ipo==0 && stime != par->ctime) { // only for ipo systems? - pushdata(par, sizeof(Object)); - pop= 1; + Object tmp= *par; if(par->proxy_from); // was a copied matrix, no where_is! bad... else where_is_object_time(scene, par, ctime); + + solve_parenting(scene, ob, par, ob->obmat, slowmat, 0); + + *par= tmp; } - - solve_parenting(scene, ob, par, ob->obmat, slowmat, 0); - - if(pop) { - poplast(par); - } + else + solve_parenting(scene, ob, par, ob->obmat, slowmat, 0); if(ob->partype & PARSLOW) { // include framerate |