From 5f84d81501ef1908256a334e1a5c52488a8e38e0 Mon Sep 17 00:00:00 2001 From: johnche Date: Fri, 13 Dec 2024 18:00:13 +0800 Subject: [PATCH] =?UTF-8?q?[unity]nodejs=E7=89=88=E6=9C=AC=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unity/native_src/Src/CppObjectMapper.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/unity/native_src/Src/CppObjectMapper.cpp b/unity/native_src/Src/CppObjectMapper.cpp index 6c8e9e413d..6a5d64b5c8 100644 --- a/unity/native_src/Src/CppObjectMapper.cpp +++ b/unity/native_src/Src/CppObjectMapper.cpp @@ -127,8 +127,17 @@ void FCppObjectMapper::CallbackDataGarbageCollected(const v8::WeakCallbackInfo

Finalize(&v8impl::g_pesapi_ffi, CallbackData->Data, DataTransfer::GetIsolatePrivateData(Data.GetIsolate())); } - CallbackData->CppObjectMapper->FunctionDatas.erase(std::remove(CallbackData->CppObjectMapper->FunctionDatas.begin(), CallbackData->CppObjectMapper->FunctionDatas.end(), - CallbackData), CallbackData->CppObjectMapper->FunctionDatas.end()); + for (auto it = CallbackData->CppObjectMapper->FunctionDatas.begin(); it != CallbackData->CppObjectMapper->FunctionDatas.end(); ) + { + if (*it == CallbackData) + { + it = CallbackData->CppObjectMapper->FunctionDatas.erase(it); + } + else + { + ++it; + } + } delete CallbackData; }