From 344b32bb643f2c65c476b8020bdf32b9eea409b1 Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Mon, 11 Feb 2019 17:25:33 -0800 Subject: [PATCH] TM iOS: avoid bad memory access when passing prop name to a lambda Summary: Depending on the timing of the method call from JS to a CxxModule, we may be accessing memory that has been deallocated, causing exception to RN runtime. This fixes it. Reviewed By: JoshuaGross, mdvacca Differential Revision: D14033831 fbshipit-source-id: 5a77aa41223b1fc3146dcf78b7f8e93375605d6d --- ReactCommon/turbomodule/core/TurboCxxModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactCommon/turbomodule/core/TurboCxxModule.cpp b/ReactCommon/turbomodule/core/TurboCxxModule.cpp index 266fa2b07..e09537187 100644 --- a/ReactCommon/turbomodule/core/TurboCxxModule.cpp +++ b/ReactCommon/turbomodule/core/TurboCxxModule.cpp @@ -62,7 +62,7 @@ jsi::Value TurboCxxModule::get(jsi::Runtime& runtime, const jsi::PropNameID& pro runtime, propName, 0, - [this, &propNameUtf8](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) { + [this, propNameUtf8](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) { return invokeMethod(rt, VoidKind, propNameUtf8, args, count); }); }