Skip to content

Commit d90f353

Browse files
committed
Updated initNoContext to take an allocator
1 parent 7fa8081 commit d90f353

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/gui.zig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,16 @@ pub fn deinit() void {
112112
mem_allocator = null;
113113
}
114114
}
115-
pub fn initNoContext() void {
115+
pub fn initNoContext(allocator: std.mem.Allocator) void {
116+
mem_allocator = allocator;
116117
if (temp_buffer == null) {
117118
temp_buffer = std.ArrayList(u8){};
118-
temp_buffer.?.resize(3 * 1024 + 1) catch unreachable;
119+
temp_buffer.?.resize(mem_allocator.?, 3 * 1024 + 1) catch unreachable;
119120
}
120121
}
121122
pub fn deinitNoContext() void {
122-
if (temp_buffer) |buf| {
123-
buf.deinit();
123+
if (temp_buffer) |*buf| {
124+
buf.deinit(mem_allocator.?);
124125
}
125126
}
126127
extern fn zguiCreateContext(shared_font_atlas: ?*const anyopaque) Context;

0 commit comments

Comments
 (0)