From 2f2e38eea5764901001f5de128cef086ec2f2ed0 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 10 Jun 2024 05:55:54 -0500 Subject: [PATCH] widgets(terminal): set global_vts to null on last exit --- src/widgets/terminal/Command.zig | 1 - src/widgets/terminal/Terminal.zig | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/widgets/terminal/Command.zig b/src/widgets/terminal/Command.zig index bdf7de7..d315a8c 100644 --- a/src/widgets/terminal/Command.zig +++ b/src/widgets/terminal/Command.zig @@ -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(); diff --git a/src/widgets/terminal/Terminal.zig b/src/widgets/terminal/Terminal.zig index f84154e..4f2ee6a 100644 --- a/src/widgets/terminal/Terminal.zig +++ b/src/widgets/terminal/Terminal.zig @@ -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| {