From d90f353a733ab34f1c62e42c01ee87993075fa7e Mon Sep 17 00:00:00 2001 From: Nic Gaffney Date: Mon, 13 Oct 2025 02:23:49 -0500 Subject: [PATCH] Updated initNoContext to take an allocator --- src/gui.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui.zig b/src/gui.zig index b12e5fd..0b3d219 100644 --- a/src/gui.zig +++ b/src/gui.zig @@ -112,15 +112,16 @@ pub fn deinit() void { mem_allocator = null; } } -pub fn initNoContext() void { +pub fn initNoContext(allocator: std.mem.Allocator) void { + mem_allocator = allocator; if (temp_buffer == null) { temp_buffer = std.ArrayList(u8){}; - temp_buffer.?.resize(3 * 1024 + 1) catch unreachable; + temp_buffer.?.resize(mem_allocator.?, 3 * 1024 + 1) catch unreachable; } } pub fn deinitNoContext() void { - if (temp_buffer) |buf| { - buf.deinit(); + if (temp_buffer) |*buf| { + buf.deinit(mem_allocator.?); } } extern fn zguiCreateContext(shared_font_atlas: ?*const anyopaque) Context;