mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-06 09:56:34 +00:00
config: need to dupe filepath for diagnostics
Fixes #2800 The source string with the filepath is not guaranteed to exist beyond the lifetime of the parse operation. We must copy it.
This commit is contained in:
@@ -56,7 +56,7 @@ pub const Location = union(enum) {
|
||||
|
||||
pub const Key = @typeInfo(Location).Union.tag_type.?;
|
||||
|
||||
pub fn fromIter(iter: anytype) Location {
|
||||
pub fn fromIter(iter: anytype, alloc: Allocator) Allocator.Error!Location {
|
||||
const Iter = t: {
|
||||
const T = @TypeOf(iter);
|
||||
break :t switch (@typeInfo(T)) {
|
||||
@@ -67,7 +67,7 @@ pub const Location = union(enum) {
|
||||
};
|
||||
|
||||
if (!@hasDecl(Iter, "location")) return .none;
|
||||
return iter.location() orelse .none;
|
||||
return (try iter.location(alloc)) orelse .none;
|
||||
}
|
||||
|
||||
pub fn clone(self: *const Location, alloc: Allocator) Allocator.Error!Location {
|
||||
|
Reference in New Issue
Block a user