stupid mistake for setting the bake mask (only masked half the faces), also exposed a possible bug since the malloc and null checks were done without mutex locking.

This commit is contained in:
Campbell Barton
2008-03-10 20:58:53 +00:00
parent 4ecf0fffaf
commit 2563733a5d

View File

@@ -2282,7 +2282,13 @@ static void shade_tface(BakeShade *bs)
if (bs->usemask) {
if (bs->ibuf->userdata==NULL) {
bs->ibuf->userdata = (void *)MEM_callocN(sizeof(char)*bs->rectx*bs->recty, "BakeMask");
BLI_lock_thread(LOCK_CUSTOM1);
if (bs->ibuf->userdata==NULL) { /* since the thread was locked, its possible another thread alloced the value */
bs->ibuf->userdata = (void *)MEM_callocN(sizeof(char)*bs->rectx*bs->recty, "BakeMask");
bs->rect_mask= (char *)bs->ibuf->userdata;
}
BLI_unlock_thread(LOCK_CUSTOM1);
} else {
bs->rect_mask= (char *)bs->ibuf->userdata;
}
}