Skip to content

Commit 0cd49cc

Browse files
authored
Merge pull request #77 from nic-gaffney/main
2 parents 2b25820 + 4fbec51 commit 0cd49cc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/gui.zig

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn initWithExistingContext(allocator: std.mem.Allocator, ctx: Context) void
7272
zguiSetCurrentContext(ctx);
7373

7474
temp_buffer = std.ArrayList(u8){};
75-
temp_buffer.?.resize(3 * 1024 + 1) catch unreachable;
75+
temp_buffer.?.resize(mem_allocator.?, 3 * 1024 + 1) catch unreachable;
7676

7777
if (te_enabled) {
7878
te.init();
@@ -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)