summaryrefslogtreecommitdiff
path: root/core/dump.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/dump.zig')
-rw-r--r--core/dump.zig12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/dump.zig b/core/dump.zig
index c348dec2..4fc7fc4d 100644
--- a/core/dump.zig
+++ b/core/dump.zig
@@ -531,17 +531,20 @@ fn restoreInner(p: *Pardes, bytes: []const u8, from: []const u8) !*Pardes {
var opts = p.opts;
opts.cols = p.view().screen_w;
opts.rows = p.view().screen_h;
+ // Loaded on the session's tape (one with clients has it from no
+ // options), which the replacement's options do not keep.
+ opts.tape = p.tape;
const replacement = try loadAndRevive(p.gpa, opts, bytes, p, null);
+ replacement.opts.tape = p.opts.tape;
replacement.pointRestoreAt(from);
// The tape follows the replacement from here (it is the session).
- pardes.tape.adopt(replacement);
+ p.tape.adopt(replacement);
pardes.ctlfs.events.notePath(replacement, "restore", from);
return replacement;
}
pub fn initFromDump(gpa: std.mem.Allocator, opts: Options, bytes: []const u8) !*Pardes {
// By hand, not `taped`: no core yet to enter on, as `Pardes.init`.
- pardes.tape.startFromEnv();
const taped = pardes.tape.enter(null, .{ .init_from_dump = .{ .opts = opts, .bytes = bytes } });
// The tape adopts the core made, none on a failure.
var made: ?*Pardes = null;
@@ -574,6 +577,10 @@ fn loadAndRevive(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, previ
var on_disk: OnDisk = @splat(false);
const p = try loadKnowing(gpa, opts, bytes, &notes, &on_disk);
errdefer p.deinit();
+ // The 9P state its requests made was its connections', which do not
+ // come with it (a client's join loads alone, and keeps it).
+ p.fs.forget(gpa);
+ for (p.panes) |slot| if (slot) |pane| pane.fs.deinit(gpa);
// Its kinds are this process's, not the dump's: the session's it
// replaces, or what the scan found (a dump of another session's).
p.kinds = if (previous) |old| old.kinds else .started(p.tape, opts.addons);
@@ -750,6 +757,7 @@ pub fn loadPane(p: *Pardes, id: usize, bytes: []const u8) !*pardes.panes.Pane {
pane.command_from = 0;
pane.places.from = 0;
pane.collapsed = false;
+ pane.fs.deinit(p.gpa);
pane.prompt_view = p.live;
try ensureKind(p, pane);
p.installPane(id, pane);