Skip to content

Commit b508dcb

Browse files
authored
Fix crash when invoking destructor from other threads than JS (#679)
1 parent ea2b1af commit b508dcb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

android/src/main/new_arch/react/renderer/components/RNLiveMarkdownSpec/MarkdownTextInputDecoratorShadowNode.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <fbjni/fbjni.h>
44
#include <react/fabric/JFabricUIManager.h>
55
#include <react/jni/ReadableNativeMap.h>
6+
#include <react/jni/SafeReleaseJniRef.h>
67
#include <react/renderer/components/view/conversions.h>
78
#include <react/renderer/core/ComponentDescriptor.h>
89
#include <yoga/Yoga.h>
@@ -45,9 +46,9 @@ void MarkdownTextInputDecoratorShadowNode::createCustomContextContainer() {
4546
const auto &fabricUIManager =
4647
this->getContextContainer()->at<JFabricUIManager::javaobject>("FabricUIManager");
4748

48-
const auto customFabricUIManager = jni::make_global(createMethod(
49+
const auto customFabricUIManager = SafeReleaseJniRef(jni::make_global(createMethod(
4950
customFabricUIManagerClass, fabricUIManager,
50-
decoratorPropsRM.get(), parserId));
51+
decoratorPropsRM.get(), parserId)));
5152
const auto contextContainer =
5253
std::make_shared<ContextContainer const>();
5354
contextContainer->insert("FabricUIManager", customFabricUIManager);

0 commit comments

Comments
 (0)