widgets(terminal): set global_vts to null on last exit

This commit is contained in:
Tim Culverhouse 2024-06-10 05:55:54 -05:00
parent 044b099227
commit 2f2e38eea5
2 changed files with 4 additions and 2 deletions

View file

@ -69,7 +69,6 @@ pub fn spawn(self: *Command, allocator: std.mem.Allocator) !void {
}
fn handleSigChild(_: c_int) callconv(.C) void {
std.log.err("sigchild", .{});
const result = std.posix.waitpid(-1, 0);
Terminal.global_vt_mutex.lock();

View file

@ -107,7 +107,10 @@ pub fn deinit(self: *Terminal) void {
var vts = global_vts orelse break :pid;
if (self.cmd.pid) |pid|
_ = vts.remove(pid);
if (vts.count() == 0) vts.deinit();
if (vts.count() == 0) {
vts.deinit();
global_vts = null;
}
}
self.cmd.kill();
if (self.thread) |thread| {