From f19436fb4d272a46f105271488fdb4408eb0cc87 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 4 Aug 2024 17:17:09 +0100 Subject: [PATCH] Only swap if there was an arena --- core/os/os2/allocators.odin | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/os/os2/allocators.odin b/core/os/os2/allocators.odin index f057ea057..47f12b540 100644 --- a/core/os/os2/allocators.odin +++ b/core/os/os2/allocators.odin @@ -48,9 +48,11 @@ temp_allocator_fini :: proc() { global_default_temp_allocator_arenas = {} } -TEMP_ALLOCATOR_GUARD_END :: proc(temp: runtime.Arena_Temp loc := #caller_location) { +TEMP_ALLOCATOR_GUARD_END :: proc(temp: runtime.Arena_Temp, loc := #caller_location) { runtime.arena_temp_end(temp, loc) - global_default_temp_allocator_index = (global_default_temp_allocator_index-1)%MAX_TEMP_ARENA_COUNT + if temp.arena != nil { + global_default_temp_allocator_index = (global_default_temp_allocator_index-1)%MAX_TEMP_ARENA_COUNT + } } @(deferred_out=TEMP_ALLOCATOR_GUARD_END)