mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Destroy jni::global_ref while inside a ThreadScope
Summary: The `BlobCollector` native module stored a `jni::global_ref` as a member, and its destructor automatically destroys it. However, as noted in JSI documentation, there is no guarantee that the destructor is run on a JVM-registered thread. The destructor knew this and used a `jni::ThreadScope` to do some other JNI behavior, but the global_ref needs to be destroyed during that ThreadScope as well. Changelog: [Internal] Reviewed By: neildhar Differential Revision: D25372698 fbshipit-source-id: f4eba0b2da154c6eac54d7faeb9ea5bb9260bec9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5fb82e7425
commit
72d29ee7d7
@@ -29,6 +29,7 @@ BlobCollector::~BlobCollector() {
|
||||
static auto removeMethod = jni::findClassStatic(kBlobModuleJavaDescriptor)
|
||||
->getMethod<void(jstring)>("remove");
|
||||
removeMethod(blobModule_, jni::make_jstring(blobId_).get());
|
||||
blobModule_.reset();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user