From 7b97bd7105beaeb0607b666ad5bf2c7cdff4d7da Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Tue, 1 Oct 2019 14:14:56 -0700 Subject: [PATCH] Fixed scratch init problem --- custom/4coder_base_types.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom/4coder_base_types.cpp b/custom/4coder_base_types.cpp index 2d9ea78d..0d754d61 100644 --- a/custom/4coder_base_types.cpp +++ b/custom/4coder_base_types.cpp @@ -2619,21 +2619,25 @@ scratch_block__init(Scratch_Block *block, Arena *arena){ block->arena = arena; block->temp = begin_temp(arena); block->do_full_clear = false; + block->tctx = 0; + block->sharable_restore = 0; } internal void scratch_block__init(Scratch_Block *block, Thread_Context *tctx, Scratch_Share_Code share){ - block->tctx = tctx; Arena *arena = tctx->sharable_scratch; if (arena != 0){ + block->arena = arena; block->temp = begin_temp(arena); block->do_full_clear = false; } else{ arena = reserve_arena(tctx); + block->arena = arena; + block_zero_struct(&block->temp); block->do_full_clear = true; } - block->arena = arena; + block->tctx = tctx; block->sharable_restore = tctx->sharable_scratch; if (share == Scratch_Share){ tctx->sharable_scratch = arena;