From f0e6eb0de0b5ac9f81ba2c728f3040c4a51ab284 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 18 Nov 2026 07:09:32 -0300 Subject: kinds: a kind's job tokens are the session's on every core, a client's plain kind keeps no job's input, and a PDF render's pixels go with the document they are of: Slot.tokens is dumped and digested (a client joined later numbers its next job as the session does; a Shadow takes it from the call's outcome), api.job on a replica gives the token alone (it runs no job, so its four input slots filled and it refused the fifth while the session asked on), and a render's answer names its document, so one that lands after its pane opened its file again (changed on disk) no longer frees pixels the old document freed with it (a double free, ABRT in the new behaviour test without the fix); kitty-harness's panic placed: the base's (the harness panics before its first line when NO_COLOR is in its environment, as zig build gives it; run by hand without it, it passes on the base and on this tree); tui core-test 820/959 (139 skipped), shell-test 994/997, behaviour-test 274/274 and --replay 0 failures, pane-test 180/181, addon-test 1/1, replicas pass (checked/wrong 0) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- src/dump.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/dump.zig') diff --git a/src/dump.zig b/src/dump.zig index c5e2953b..742a9574 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -774,6 +774,8 @@ const SlotRecord = struct { focused: bool = false, /// The jobs whose answers it dropped (api.cancel): a replica's drop them too. cancelled: [4]u32 = @splat(0), + /// Its last job's token (Kind.Slot.tokens): a client's next is the session's. + tokens: u32 = 0, /// Its tick's prefix: a replica's tag laid out as the session's. prefix: []const u8 = "", /// A placeholder's why (its file not here). @@ -793,7 +795,7 @@ const SlotRecord = struct { pub fn slotWrite(s: *const Kind.Slot, gpa: std.mem.Allocator, w: *std.Io.Writer) !void { var place: [32]u8 = undefined; - var r: SlotRecord = .{ .name = s.nameOf(), .version = s.version, .gen = s.gen, .path = s.path, .art = s.art, .record = s.record, .where = s.where_text.slice(), .values = s.values.slice(), .live = s.live, .next_tick = s.next_tick, .views = s.views, .focused = s.focused, .cancelled = s.cancelled, .prefix = s.prefix.slice(), .refused = s.refused.slice(), .tail = s.tail.slice(), .selection = s.selection, .state = s.state }; + var r: SlotRecord = .{ .name = s.nameOf(), .version = s.version, .gen = s.gen, .path = s.path, .art = s.art, .record = s.record, .where = s.where_text.slice(), .values = s.values.slice(), .live = s.live, .next_tick = s.next_tick, .views = s.views, .focused = s.focused, .cancelled = s.cancelled, .tokens = s.tokens, .prefix = s.prefix.slice(), .refused = s.refused.slice(), .tail = s.tail.slice(), .selection = s.selection, .state = s.state }; var owned: ?[]u8 = null; defer if (owned) |o| s.gpa.free(o); if (s.ops != null) { @@ -835,7 +837,7 @@ pub fn slotRead(out: *Kind.Slot, gpa: std.mem.Allocator, bytes: []const u8) !voi var arena: std.heap.ArenaAllocator = .init(gpa); defer arena.deinit(); const r = try walk.load(SlotRecord, arena.allocator(), bytes, null); - out.* = .{ .gpa = gpa, .arena = .init(gpa), .version = r.version, .gen = r.gen, .art = r.art, .live = r.live, .next_tick = r.next_tick, .views = r.views, .focused = r.focused, .cancelled = r.cancelled, .state = r.state }; + out.* = .{ .gpa = gpa, .arena = .init(gpa), .version = r.version, .gen = r.gen, .art = r.art, .live = r.live, .next_tick = r.next_tick, .views = r.views, .focused = r.focused, .cancelled = r.cancelled, .tokens = r.tokens, .state = r.state }; errdefer out.free(); @memcpy(out.name[0..@min(15, r.name.len)], r.name[0..@min(15, r.name.len)]); out.path = try gpa.dupe(u8, r.path); -- cgit v1.3