From c87e87365db76daadca6f5e23f036e71414684f7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 8 Sep 2022 13:30:00 +0200 Subject: [PATCH] - fixed: all script methods adding an object to a dynamic array must perform a write barrier. --- src/common/scripting/core/dynarrays.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/scripting/core/dynarrays.cpp b/src/common/scripting/core/dynarrays.cpp index 8c51daa9479..1d03fe3a724 100644 --- a/src/common/scripting/core/dynarrays.cpp +++ b/src/common/scripting/core/dynarrays.cpp @@ -846,6 +846,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Copy, ArrayCopy) { PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj); PARAM_POINTER(other, FDynArray_Obj); + for (auto& elem : *other) GC::WriteBarrier(elem); *self = *other; return 0; } @@ -854,6 +855,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Move, ArrayMove) { PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj); PARAM_POINTER(other, FDynArray_Obj); + for (auto& elem : *other) GC::WriteBarrier(elem); *self = std::move(*other); return 0; } @@ -862,6 +864,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Append, ArrayAppend) { PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj); PARAM_POINTER(other, FDynArray_Obj); + for (auto& elem : *other) GC::WriteBarrier(elem); self->Append(*other); return 0; } @@ -883,6 +886,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_Obj, Push, ObjArrayPush) { PARAM_SELF_STRUCT_PROLOGUE(FDynArray_Obj); PARAM_OBJECT(val, DObject); + GC::WriteBarrier(val); ACTION_RETURN_INT(ObjArrayPush(self, val)); }