diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2006-10-01 01:29:47 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2006-10-01 01:29:47 +0400 |
commit | dfa01a56ba325e03bac00a44612ba0c80e1f945c (patch) | |
tree | 99f0c29f146bcd3280970545b9ce22d81bf34ec1 /source/blender/render | |
parent | 0b7e25d3bd3b6f5b7d7d8b8c0047c4b03684522d (diff) |
Fix for bug #5044: random crashes when rendering.
This one is of my own making, removed too many locks. Thanks Malefico for reporting.
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/envmap.c | 5 | ||||
-rw-r--r-- | source/blender/render/intern/source/imagetexture.c | 28 |
2 files changed, 24 insertions, 9 deletions
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 6e9088b364a..c511bc043dc 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -33,6 +33,7 @@ #include "BLI_arithb.h" #include "BLI_blenlib.h" +#include "BLI_threads.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" /* for rectcpy */ @@ -645,9 +646,11 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe if(env->ima && env->ima->ok) { if(env->ima->ibuf==NULL) { printf("load ibuf\n"); - ima_ibuf_is_nul(tex, tex->ima); + BLI_lock_thread(LOCK_CUSTOM1); + if(ima->ibuf==NULL) ima_ibuf_is_nul(tex, tex->ima); if(env->ima->ok && env->ok==0) envmap_split_ima(env); + BLI_unlock_thread(LOCK_CUSTOM1); } } } diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index db0c388735d..4f4f703c523 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -48,6 +48,7 @@ #include "DNA_texture_types.h" #include "BLI_blenlib.h" +#include "BLI_threads.h" #include "BKE_utildefines.h" #include "BKE_global.h" @@ -104,8 +105,11 @@ int imagewrap(Tex *tex, Image *ima, float *texvec, TexResult *texres) /* hack for icon render */ if(R.r.scemode &R_NO_IMAGE_LOAD) return 0; - if(ima->ibuf==NULL) - ima_ibuf_is_nul(tex, ima); + if(ima->ibuf==NULL) { + BLI_lock_thread(LOCK_CUSTOM1); + if(ima->ibuf==NULL) ima_ibuf_is_nul(tex, ima); + BLI_unlock_thread(LOCK_CUSTOM1); + } } if (ima->ok) { @@ -626,15 +630,23 @@ int imagewraposa(Tex *tex, Image *ima, float *texvec, float *dxt, float *dyt, Te return retval; } - if(ima->ibuf==NULL) - ima_ibuf_is_nul(tex, ima); + if(ima->ibuf==NULL) { + BLI_lock_thread(LOCK_CUSTOM1); + if(ima->ibuf==NULL) ima_ibuf_is_nul(tex, ima); + BLI_unlock_thread(LOCK_CUSTOM1); + } if (ima->ok) { - if(tex->imaflag & TEX_MIPMAP) - if(ima->mipmap[0]==NULL) - if(ima->mipmap[0]==NULL) - makemipmap(tex, ima); + if(tex->imaflag & TEX_MIPMAP) { + if(ima->mipmap[0]==NULL) { + if(ima->mipmap[0]==NULL) { + BLI_lock_thread(LOCK_CUSTOM1); + if(ima->mipmap[0]==NULL) makemipmap(tex, ima); + BLI_unlock_thread(LOCK_CUSTOM1); + } + } + } ibuf = ima->ibuf; |