diff options
Diffstat (limited to 'core/Kind.zig')
| -rw-r--r-- | core/Kind.zig | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/Kind.zig b/core/Kind.zig index 4841a55c..22a7ebe0 100644 --- a/core/Kind.zig +++ b/core/Kind.zig @@ -320,10 +320,16 @@ pub fn reopen(p: *Pardes, id: usize, s: *Slot, bytes: ?[]const u8) bool { if (p.kinds.byName(s.nameOf())) |k| { // Its code: its library loaded at the first pane of its kind. if (s.ops == null) s.ops = Addon.need(&p.kinds, p.tape, k, &cl.refused, p.opts.distrusted); - // Its block made afresh by this open. + // Its block made afresh by this open. And what a plain kind keeps + // beside it (a PDF's document), made in every core that runs it, is + // no rollback copy's: a write outside the copy (Pardes.outside), + // counted by the registry's word on every side alike, the kind's + // code here or not. A client that kept this step to replay over its + // copy would make that state again and never close the first. if (p.kinds.kinds[k].caps.plain) { if (s.plain) |b| if (b.len > 0) s.gpa.free(b); s.plain = &.{}; + p.outside.n +%= 1; } // Its tag's computed words (UX K'3): its words, then Del. var w: std.Io.Writer = .fixed(&s.tail.bytes); @@ -416,6 +422,11 @@ pub fn close(p: *Pardes, pane: *Pane) void { // own memory (its pictures) is left be, as the rollback brings the pane // back; the session's order closes it. const kept = s.plain != null and s.ops != null and s.ops.?.close != null and p.tape.authorityOnly("a kind's close"); + // What a plain kind keeps beside its block let go: outside the copy, as + // its open was (reopen). + if (p.kinds.byName(s.nameOf())) |k| if (p.kinds.kinds[k].caps.plain) { + p.outside.n +%= 1; + }; if (!kept) { var i: usize = 0; while (i < ready.items.len) if (ready.items[i].draw == p and ready.items[i].serial == pane.serial) ready.orderedRemove(i).drop() else { |
