From c3522a017d8ad4872a3f5744218f2edf3fd6183c Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Fri, 22 Feb 2019 08:56:40 -0800 Subject: [PATCH] Don't call `jni_YGNodeFree` as fast native method Summary: @public If `jni_YGNodeFree` is called while GC is running, the weak reference table lock is held by the GC, leading to deadlock. Here, we revert the method to being a regular native method, solving that problem. Reviewed By: SidharthGuglani Differential Revision: D14184220 fbshipit-source-id: 2882fa10586617cea2df99550a7dd8885376d11e --- ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.cpp b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.cpp index a249b2e6f3..9b7a7dadb0 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.cpp +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.cpp @@ -376,7 +376,7 @@ jlong jni_YGNodeClone( return reinterpret_cast(clonedYogaNode); } -void jni_YGNodeFree(jlong nativePointer) { +void jni_YGNodeFree(alias_ref, jlong nativePointer) { if (nativePointer == 0) { return; } @@ -728,7 +728,7 @@ jint JNI_OnLoad(JavaVM* vm, void*) { { YGMakeNativeMethod(jni_YGNodeNew), YGMakeNativeMethod(jni_YGNodeNewWithConfig), - YGMakeCriticalNativeMethod(jni_YGNodeFree), + YGMakeNativeMethod(jni_YGNodeFree), YGMakeCriticalNativeMethod(jni_YGNodeReset), YGMakeCriticalNativeMethod(jni_YGNodeClearChildren), YGMakeCriticalNativeMethod(jni_YGNodeInsertChild),