Fix #134293: Compositor crash after adding view layer

The compositor crashes when the active viewer layers is deleted and
replaced by a new layer. That's because the depsgraph of the compositor
still references the old view layer. To fix this, we need to update the
view layer of the compositor if it changed since it was last created.

Pull Request: https://projects.blender.org/blender/blender/pulls/134326
This commit is contained in:
Omar Emara
2025-02-10 13:09:03 +01:00
committed by Omar Emara
parent d006924ebc
commit acfc8f2cc6

View File

@@ -248,6 +248,12 @@ static void compo_initjob(void *cjv)
DEG_debug_name_set(compositor_runtime.preview_depsgraph, "COMPOSITOR");
}
/* Update the viewer layer of the compositor since it changed since the depsgraph was created. */
if (DEG_get_input_view_layer(compositor_runtime.preview_depsgraph) != view_layer) {
DEG_graph_replace_owners(compositor_runtime.preview_depsgraph, bmain, scene, view_layer);
DEG_graph_tag_relations_update(compositor_runtime.preview_depsgraph);
}
cj->compositor_depsgraph = compositor_runtime.preview_depsgraph;
DEG_graph_build_for_compositor_preview(cj->compositor_depsgraph, cj->ntree);