Fix T41180: Crash when using motion blur with Freestyle.
In pipeline.c, do_render_3d() is called multiple times for each frame when motion blur is used. This caused duplicates of the same struct Render instance in re->freestyle_renders, resulting in fatal double freeing of allocated memory.
This commit is contained in:
parent
333aaca294
commit
698a9a2434
Notes:
blender-bot
2023-02-14 10:18:49 +01:00
Referenced by issue #41209, Run Armature actuator not working with DupliGroup object. Referenced by issue #41205, Volume Distance is not taken. Referenced by issue #41180, Crash when using motion blur with Freestyle.
|
@ -1935,6 +1935,8 @@ static void add_freestyle(Render *re, int render)
|
|||
{
|
||||
SceneRenderLayer *srl, *actsrl;
|
||||
LinkData *link;
|
||||
Render *r;
|
||||
const bool do_link = (re->r.mode & R_MBLUR) == 0 || re->i.curblur == re->r.mblur_samples;
|
||||
|
||||
actsrl = BLI_findlink(&re->r.layers, re->r.actlay);
|
||||
|
||||
|
@ -1951,15 +1953,17 @@ static void add_freestyle(Render *re, int render)
|
|||
|
||||
FRS_init_stroke_rendering(re);
|
||||
|
||||
for (srl= (SceneRenderLayer *)re->r.layers.first; srl; srl= srl->next) {
|
||||
|
||||
link = (LinkData *)MEM_callocN(sizeof(LinkData), "LinkData to Freestyle render");
|
||||
BLI_addtail(&re->freestyle_renders, link);
|
||||
|
||||
for (srl = (SceneRenderLayer *)re->r.layers.first; srl; srl = srl->next) {
|
||||
if (do_link) {
|
||||
link = (LinkData *)MEM_callocN(sizeof(LinkData), "LinkData to Freestyle render");
|
||||
BLI_addtail(&re->freestyle_renders, link);
|
||||
}
|
||||
if ((re->r.scemode & R_SINGLE_LAYER) && srl != actsrl)
|
||||
continue;
|
||||
if (FRS_is_freestyle_enabled(srl)) {
|
||||
link->data = (void *)FRS_do_stroke_rendering(re, srl, render);
|
||||
r = FRS_do_stroke_rendering(re, srl, render);
|
||||
if (do_link)
|
||||
link->data = (void *)r;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue