seems to fix segfault by not giving up control of the tty, shutting down when it's aready deferred could be the issue?

This commit is contained in:
peterc-s 2024-10-22 12:17:22 +01:00
parent 5e05d29e0c
commit c54ca6761d
No known key found for this signature in database
GPG Key ID: 41E806B8F7F83E59
2 changed files with 5 additions and 6 deletions

View File

@ -97,9 +97,9 @@ pub fn draw(self: Doom) void {
}
fn initBuffer(buffer: []u8, width: usize) void {
const length = buffer.len - width;
const length = buffer.len;
const slice_start = buffer[0..length];
const slice_end = buffer[length..];
const slice_end = buffer[length - width .. length];
@memset(slice_start, 0);
@memset(slice_end, STEPS - 1);

View File

@ -317,9 +317,9 @@ pub fn main() !void {
}
}
var animation_timer = switch(config.animation) {
var animation_timer = switch (config.animation) {
.none => undefined,
else => try std.time.Timer.start()
else => try std.time.Timer.start(),
};
const animate = config.animation != .none;
@ -345,7 +345,6 @@ pub fn main() !void {
try info_line.addMessage(lang.err_console_dev, config.error_bg, config.error_fg);
};
while (run) {
// If there's no input or there's an animation, a resolution change needs to be checked
if (!update or config.animation != .none) {
@ -706,7 +705,7 @@ pub fn main() !void {
defer allocator.free(password_text);
// Give up control on the TTY
_ = termbox.tb_shutdown();
// _ = termbox.tb_shutdown();
session_pid = try std.posix.fork();
if (session_pid == 0) {