diff --git a/ReactAndroid/src/main/jni/react/JSCExecutor.cpp b/ReactAndroid/src/main/jni/react/JSCExecutor.cpp index b12021d41..a657a72f1 100644 --- a/ReactAndroid/src/main/jni/react/JSCExecutor.cpp +++ b/ReactAndroid/src/main/jni/react/JSCExecutor.cpp @@ -86,7 +86,6 @@ static std::string executeJSCallWithJSC( "__fbBatchedBridge.", methodName, ".apply(null, ", folly::toJson(jsonArgs), ")"); auto result = evaluateScript(ctx, String(js.c_str()), nullptr); - JSValueProtect(ctx, result); return Value(ctx, result).toJSONString(); } @@ -247,7 +246,6 @@ static JSValueRef nativeFlushQueueImmediate( return JSValueMakeUndefined(ctx); } - JSValueProtect(ctx, arguments[0]); std::string resStr = Value(ctx, arguments[0]).toJSONString(); executor->flushQueueImmediate(resStr); diff --git a/ReactAndroid/src/main/jni/react/Value.cpp b/ReactAndroid/src/main/jni/react/Value.cpp index 0859ca452..0acbc38c8 100644 --- a/ReactAndroid/src/main/jni/react/Value.cpp +++ b/ReactAndroid/src/main/jni/react/Value.cpp @@ -23,12 +23,6 @@ Value::Value(Value&& other) : other.m_value = nullptr; } -Value::~Value() { - if (m_value) { - JSValueUnprotect(m_context, m_value); - } -} - JSContextRef Value::context() const { return m_context; } @@ -37,7 +31,6 @@ std::string Value::toJSONString(unsigned indent) const { JSValueRef exn; auto stringToAdopt = JSValueCreateJSONString(m_context, m_value, indent, &exn); if (stringToAdopt == nullptr) { - JSValueProtect(m_context, exn); std::string exceptionText = Value(m_context, exn).toString().str(); throwJSExecutionException("Exception creating JSON string: %s", exceptionText.c_str()); } diff --git a/ReactAndroid/src/main/jni/react/Value.h b/ReactAndroid/src/main/jni/react/Value.h index c237bda18..8a845ebfe 100644 --- a/ReactAndroid/src/main/jni/react/Value.h +++ b/ReactAndroid/src/main/jni/react/Value.h @@ -142,7 +142,6 @@ class Value : public noncopyable { public: Value(JSContextRef context, JSValueRef value); Value(Value&&); - ~Value(); operator JSValueRef() const { return m_value;