Fix #137724: Crash during render compositing

Blender crashes if the compositor runs from the render pipeline while
the node tree is being drawn. That's because the render pipeline
adjusting the original node tree by calling ntreeCompositTagRender from
a different thread during compositor evaluation, which is unsafe while
the node tree is being drawn on the main thread.

ntreeCompositTagRender seems to update Composite and Texture nodes, but
they don't have update function, so it seems to do nothing in those
cases. It also updates nodes that reference the scene, like the Render
Layers and Cryptomatte nodes, but this seems to be already done in other
places like do_render_compositor_scenes and ntreeCompositUpdateRLayers.
Furthermore, in one of the calls in the render pipeline, it does raw
pointer comparison with the evaluated scene, so the comparison fails and
it does nothing.

Considering the above, it seems this can be omitted from the render
pipeline code.

Pull Request: https://projects.blender.org/blender/blender/pulls/138087
This commit is contained in:
Omar Emara
2025-04-28 14:48:47 +02:00
committed by Omar Emara
parent 733d65e514
commit 375ff1df6b

View File

@@ -1355,11 +1355,6 @@ static void do_render_compositor(Render *re)
}
if (!re->test_break()) {
if (ntree) {
ntreeCompositTagRender(re->pipeline_scene_eval);
}
if (ntree && re->scene->use_nodes && re->r.scemode & R_DOCOMP) {
/* checks if there are render-result nodes that need scene */
if ((re->r.scemode & R_SINGLE_LAYER) == 0) {
@@ -1991,9 +1986,6 @@ static bool render_init_from_main(Render *re,
return false;
}
/* Init-state makes new result, have to send changed tags around. */
ntreeCompositTagRender(re->scene);
re->display_init(re->result);
re->display_clear(re->result);