From 0f04b1b6732d02e36d2d95442d96af5fbcc5a680 Mon Sep 17 00:00:00 2001 From: Wertzui123 <46199283+Wertzui123@users.noreply.github.com> Date: Sat, 14 Sep 2024 18:28:00 +0200 Subject: [PATCH] runtime: fix arguments getting corrupted when launching a method on a new thread --- stdlib/aspl/compiler/backend/stringcode/c/template.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/aspl/compiler/backend/stringcode/c/template.c b/stdlib/aspl/compiler/backend/stringcode/c/template.c index df65682..eb5c39f 100644 --- a/stdlib/aspl/compiler/backend/stringcode/c/template.c +++ b/stdlib/aspl/compiler/backend/stringcode/c/template.c @@ -608,7 +608,8 @@ void ASPL_LAUNCH_THREAD_METHOD(ASPL_OBJECT_TYPE (*callback)(ASPL_OBJECT_TYPE*, A ASPL_ThreadMethodWrapperData* args = ASPL_MALLOC(sizeof(ASPL_ThreadMethodWrapperData)); args->callback = callback; args->this = this; - args->args = arguments; + args->args = ASPL_MALLOC(arg_size); + memcpy(args->args, arguments, arg_size); thread_create(aspl_method_thread_wrapper, args, THREAD_STACK_SIZE_DEFAULT); } #endif