From 1c655b84e48446f581a16463bb6c4d84d7a4116b Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Thu, 17 Apr 2025 16:53:07 +0200 Subject: [PATCH] Fix #5049 Keep in mind that `thread.create` needs an allocator to be set, as it returns `^Thread`. --- core/thread/thread.odin | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/thread/thread.odin b/core/thread/thread.odin index c1cbceb42..722cf393b 100644 --- a/core/thread/thread.odin +++ b/core/thread/thread.odin @@ -513,8 +513,10 @@ _select_context_for_thread :: proc(init_context: Maybe(runtime.Context)) -> runt Ensure that the temp allocator is thread-safe when the user provides a specific initial context to use. Without this, the thread will use the same temp allocator state as the parent thread, and thus, bork it up. */ - if ctx.temp_allocator.procedure == runtime.default_temp_allocator_proc { - ctx.temp_allocator.data = &runtime.global_default_temp_allocator_data + when !ODIN_DEFAULT_TO_NIL_ALLOCATOR { + if ctx.temp_allocator.procedure == runtime.default_temp_allocator_proc { + ctx.temp_allocator.data = &runtime.global_default_temp_allocator_data + } } return ctx }