Fixed deinitialisation bug

This commit is contained in:
Warwick 2024-11-15 16:39:51 +00:00
parent 20cae4b6e0
commit 2d4acf9572

View file

@ -18,15 +18,15 @@ pub fn main() !void {
const deinit_status = gpa.deinit(); const deinit_status = gpa.deinit();
//fail test; can't try in defer as defer is executed after we return //fail test; can't try in defer as defer is executed after we return
if (deinit_status == .leak) { if (deinit_status == .leak) {
std.log.err("memory leak ", .{}); std.log.err("memory leak", .{});
} }
} }
var allocator = gpa.allocator(); var allocator = gpa.allocator();
var tty = try vaxis.Tty.init(); var tty = try vaxis.Tty.init();
defer tty.deinit();
var vx = try vaxis.init(allocator, .{}); var vx = try vaxis.init(allocator, .{});
defer vx.deinit(allocator, tty.anyWriter()); defer vx.deinit(allocator, tty.anyWriter());
defer tty.deinit();
var topic_screen: TopicScreen = try TopicScreen.init(&allocator, &tty, &vx); var topic_screen: TopicScreen = try TopicScreen.init(&allocator, &tty, &vx);
var screen_interface = topic_screen.screenInterface(); var screen_interface = topic_screen.screenInterface();