forked from bartvdbraak/blender
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.
This commit is contained in:
parent
00318eaa2e
commit
cbc4aae06a
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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*/
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user