fix: Fix close
being called on a collected reference (enforce alias_ref
) (#379)
* fix: Fix `close` being called on a collected reference (enforce `alias_ref`) * Remove `~FrameHostObject` on iOS too
This commit is contained in:
@@ -77,15 +77,9 @@ void JImageProxyHostObject::assertIsFrameStrong(jsi::Runtime& runtime, const std
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JImageProxyHostObject::~JImageProxyHostObject() {
|
||||
this->close();
|
||||
}
|
||||
|
||||
void JImageProxyHostObject::close() {
|
||||
if (this->frame) {
|
||||
this->frame->close();
|
||||
this->frame.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,8 +18,7 @@ using namespace facebook;
|
||||
|
||||
class JSI_EXPORT JImageProxyHostObject : public jsi::HostObject {
|
||||
public:
|
||||
explicit JImageProxyHostObject(jni::local_ref<JImageProxy::javaobject> image): frame(image) {}
|
||||
~JImageProxyHostObject();
|
||||
explicit JImageProxyHostObject(jni::alias_ref<JImageProxy::javaobject> image): frame(image) {}
|
||||
|
||||
public:
|
||||
jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
|
||||
@@ -28,7 +27,7 @@ class JSI_EXPORT JImageProxyHostObject : public jsi::HostObject {
|
||||
void close();
|
||||
|
||||
public:
|
||||
jni::local_ref<JImageProxy> frame;
|
||||
jni::alias_ref<JImageProxy> frame;
|
||||
|
||||
private:
|
||||
static auto constexpr TAG = "VisionCamera";
|
||||
|
Reference in New Issue
Block a user