fix [#34105] bake artifacts

different threads could allocate the mask buffer and overwrite the same pointer, regression since 2.65
This commit is contained in:
Campbell Barton 2013-02-05 08:16:04 +00:00
parent 2c0a3cf42e
commit 791e38afd2

@ -818,10 +818,13 @@ static void shade_tface(BakeShade *bs)
BLI_lock_thread(LOCK_CUSTOM1);
userdata = bs->ibuf->userdata;
if (userdata == NULL) /* since the thread was locked, its possible another thread alloced the value */
userdata = MEM_callocN(sizeof(BakeImBufuserData), "BakeMask");
userdata = MEM_callocN(sizeof(BakeImBufuserData), STRINGIFY(BakeImBufuserData));
if (bs->use_mask)
userdata->mask_buffer = MEM_callocN(sizeof(char) * bs->rectx * bs->recty, "BakeMask");
if (bs->use_mask) {
if (userdata->mask_buffer == NULL) {
userdata->mask_buffer = MEM_callocN(sizeof(char) * bs->rectx * bs->recty, "BakeMask");
}
}
if (bs->use_displacement_buffer)
userdata->displacement_buffer = MEM_callocN(sizeof(float) * bs->rectx * bs->recty, "BakeDisp");