fix: Fix Frame Processor null-dereference error (use ref-counted JNI local_ref) (#351)

This commit is contained in:
Marc Rousavy 2021-08-20 15:57:31 +02:00 committed by GitHub
parent cae08a1402
commit d06bcf648c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -11,7 +11,7 @@ using namespace facebook;
using namespace jni;
using TSelf = local_ref<HybridClass<FrameProcessorPlugin>::jhybriddata>;
using TFrameProcessorPlugin = jobject(alias_ref<JImageProxy::javaobject>, alias_ref<JArrayClass<jobject>>);
using TFrameProcessorPlugin = jobject(local_ref<JImageProxy::javaobject>, local_ref<JArrayClass<jobject>>);
TSelf vision::FrameProcessorPlugin::initHybrid(alias_ref<HybridClass::jhybridobject> jThis, const std::string& name) {
return makeCxxInstance(jThis, name);
@ -24,7 +24,7 @@ void FrameProcessorPlugin::registerNatives() {
});
}
local_ref<jobject> FrameProcessorPlugin::callback(alias_ref<JImageProxy::javaobject> image, alias_ref<JArrayClass<jobject>> params) {
local_ref<jobject> FrameProcessorPlugin::callback(local_ref<JImageProxy::javaobject> image, local_ref<JArrayClass<jobject>> params) {
static const auto func = javaPart_->getClass()->getMethod<TFrameProcessorPlugin>("callback");
auto result = func(javaPart_.get(), image, params);
return make_local(result);

View File

@ -22,7 +22,7 @@ class FrameProcessorPlugin: public HybridClass<FrameProcessorPlugin> {
const std::string& name);
static void registerNatives();
local_ref<jobject> callback(alias_ref<JImageProxy::javaobject> image, alias_ref<JArrayClass<jobject>> params);
local_ref<jobject> callback(local_ref<JImageProxy::javaobject> image, local_ref<JArrayClass<jobject>> params);
std::string getName();
private: