mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
main: fix tracy allocator in GlobalState
This commit is contained in:
10
src/main.zig
10
src/main.zig
@ -173,6 +173,7 @@ pub const GlobalState = struct {
|
|||||||
|
|
||||||
gpa: ?GPA,
|
gpa: ?GPA,
|
||||||
alloc: std.mem.Allocator,
|
alloc: std.mem.Allocator,
|
||||||
|
tracy: if (tracy.enabled) ?tracy.Allocator(null) else void,
|
||||||
|
|
||||||
pub fn init(self: *GlobalState) void {
|
pub fn init(self: *GlobalState) void {
|
||||||
// Output some debug information right away
|
// Output some debug information right away
|
||||||
@ -194,6 +195,7 @@ pub const GlobalState = struct {
|
|||||||
self.* = .{
|
self.* = .{
|
||||||
.gpa = null,
|
.gpa = null,
|
||||||
.alloc = undefined,
|
.alloc = undefined,
|
||||||
|
.tracy = undefined,
|
||||||
};
|
};
|
||||||
errdefer self.deinit();
|
errdefer self.deinit();
|
||||||
|
|
||||||
@ -224,8 +226,8 @@ pub const GlobalState = struct {
|
|||||||
|
|
||||||
// If we're tracing, wrap the allocator
|
// If we're tracing, wrap the allocator
|
||||||
if (!tracy.enabled) break :alloc base;
|
if (!tracy.enabled) break :alloc base;
|
||||||
var tracy_alloc = tracy.allocator(base, null);
|
self.tracy = tracy.allocator(base, null);
|
||||||
break :alloc tracy_alloc.allocator();
|
break :alloc self.tracy.?.allocator();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +239,10 @@ pub const GlobalState = struct {
|
|||||||
// the point at which it will output if there were safety violations.
|
// the point at which it will output if there were safety violations.
|
||||||
_ = value.deinit();
|
_ = value.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tracy.enabled) {
|
||||||
|
self.tracy = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
test {
|
test {
|
||||||
|
Reference in New Issue
Block a user