未验证 提交 aeeeda8f 编写于 作者: O openharmony_ci 提交者: Gitee

!656 fix RemoteObject mem leak--rollbakck

Merge pull request !656 from 马根堂/master
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
private: private:
std::mutex mutex_; std::mutex mutex_;
std::u16string descriptor_; std::u16string descriptor_;
wptr<JRemoteObject> cachedObject_; sptr<JRemoteObject> cachedObject_;
}; };
/* /*
...@@ -250,7 +250,7 @@ sptr<JRemoteObject> JRemoteObjectHolder::Get(jobject object) ...@@ -250,7 +250,7 @@ sptr<JRemoteObject> JRemoteObjectHolder::Get(jobject object)
// so it will not be freed util this reference released. // so it will not be freed util this reference released.
sptr<JRemoteObject> remoteObject = nullptr; sptr<JRemoteObject> remoteObject = nullptr;
if (cachedObject_ != nullptr) { if (cachedObject_ != nullptr) {
remoteObject = cachedObject_.promote(); remoteObject = cachedObject_;
} }
if (remoteObject == nullptr) { if (remoteObject == nullptr) {
......
...@@ -64,7 +64,7 @@ private: ...@@ -64,7 +64,7 @@ private:
std::mutex mutex_; std::mutex mutex_;
napi_env env_ = nullptr; napi_env env_ = nullptr;
std::u16string descriptor_; std::u16string descriptor_;
wptr<NAPIRemoteObject> cachedObject_; sptr<NAPIRemoteObject> cachedObject_;
napi_ref localInterfaceRef_; napi_ref localInterfaceRef_;
int32_t attachCount_; int32_t attachCount_;
}; };
......
...@@ -38,7 +38,7 @@ sptr<NAPIRemoteObject> NAPIRemoteObjectHolder::Get(napi_value jsRemoteObject) ...@@ -38,7 +38,7 @@ sptr<NAPIRemoteObject> NAPIRemoteObjectHolder::Get(napi_value jsRemoteObject)
// so it will not be freed util this reference released. // so it will not be freed util this reference released.
sptr<NAPIRemoteObject> remoteObject = nullptr; sptr<NAPIRemoteObject> remoteObject = nullptr;
if (cachedObject_ != nullptr) { if (cachedObject_ != nullptr) {
remoteObject = cachedObject_.promote(); remoteObject = cachedObject_;
} }
if (remoteObject == nullptr) { if (remoteObject == nullptr) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册