Fix #127292: Cryptomatte passes are missing meta-data

Meta-data are missing on Cryptomatte layers in the GPU compositor, so
they do not get saved using the File Output node. This is due to a use
after free error where a temporary string is used in the meta-data
population logic. This is fixed by assigning the string to a temporary
variable instead.

Thanks to Jorn Visser for finding the cause of the issue.
This commit is contained in:
Omar Emara
2024-10-22 11:50:04 +03:00
parent 71398478b2
commit cce896fe11

View File

@@ -394,8 +394,9 @@ class Context : public realtime_compositor::Context {
/* We assume the given pass is a Cryptomatte pass and retrieve its layer name. If it wasn't a
* Cryptomatte pass, the checks below will fail anyways. */
const std::string combined_pass_name = std::string(view_layer->name) + "." + pass_name;
StringRef cryptomatte_layer_name = bke::cryptomatte::BKE_cryptomatte_extract_layer_name(
std::string(view_layer->name) + "." + pass_name);
combined_pass_name);
struct StampCallbackData {
std::string cryptomatte_layer_name;