Copy array of strings instead of assuming lifetime

Current setup works fine if passed static memory like '&.{ "glslc" }', but produces errors of various types (segmentation faults, access denied, file doesn't exist, etc) if passed a dynamically allocated slice, such as a slice containing the result of a call to `Builder.pathJoin`, a la `b.pathJoin(&.{ b.env_map.get("VULKAN_SDK").?, "bin", "glslc" })`.
This commit is contained in:
InKryption
2021-12-27 23:17:07 +01:00
committed by GitHub
parent eb4373bb7c
commit 2c9aa3655d

View File

@@ -32,7 +32,7 @@ pub const ShaderCompileStep = struct {
self.* = .{ self.* = .{
.step = Step.init(.custom, "shader-compile", builder.allocator, make), .step = Step.init(.custom, "shader-compile", builder.allocator, make),
.builder = builder, .builder = builder,
.glslc_cmd = glslc_cmd, .glslc_cmd = builder.dupeStrings(glslc_cmd),
.shaders = std.ArrayList(Shader).init(builder.allocator), .shaders = std.ArrayList(Shader).init(builder.allocator),
}; };
return self; return self;