mirror of
https://gitee.com/openharmony/distributeddatamgr_relational_store
synced 2024-11-23 07:00:41 +00:00
code fix
Signed-off-by: wanning.fang <songruirui1@huawei.com>
This commit is contained in:
parent
2d606da950
commit
293a5e592e
@ -40,8 +40,6 @@ public:
|
||||
static napi_value Napi_NormalizeUri(napi_env env, napi_callback_info info);
|
||||
static napi_value Napi_DenormalizeUri(napi_env env, napi_callback_info info);
|
||||
static napi_value Napi_NotifyChange(napi_env env, napi_callback_info info);
|
||||
|
||||
void ReleaseObserverMap();
|
||||
private:
|
||||
static napi_value GetConstructor(napi_env env);
|
||||
static napi_value Initialize(napi_env env, napi_callback_info info);
|
||||
|
@ -163,7 +163,14 @@ napi_value NapiDataShareHelper::Initialize(napi_env env, napi_callback_info info
|
||||
auto finalize = [](napi_env env, void * data, void * hint) {
|
||||
NapiDataShareHelper *proxy = reinterpret_cast<NapiDataShareHelper *>(data);
|
||||
if (proxy != nullptr) {
|
||||
proxy->ReleaseObserverMap();
|
||||
auto it = proxy->observerMap_.begin();
|
||||
while (it != proxy->observerMap_.end()) {
|
||||
if (proxy->datashareHelper_ != nullptr) {
|
||||
proxy->datashareHelper_->UnregisterObserver(Uri(it->first), it->second);
|
||||
}
|
||||
it->second->DeleteReference();
|
||||
}
|
||||
proxy->observerMap_.clear();
|
||||
delete proxy;
|
||||
}
|
||||
};
|
||||
@ -174,15 +181,6 @@ napi_value NapiDataShareHelper::Initialize(napi_env env, napi_callback_info info
|
||||
return self;
|
||||
}
|
||||
|
||||
void NapiDataShareHelper::ReleaseObserverMap()
|
||||
{
|
||||
auto it = this->observerMap_.begin();
|
||||
while (it != this->observerMap_.end()) {
|
||||
it->second->DeleteReference();
|
||||
}
|
||||
this->observerMap_.clear();
|
||||
}
|
||||
|
||||
napi_value NapiDataShareHelper::Napi_OpenFile(napi_env env, napi_callback_info info)
|
||||
{
|
||||
LOG_DEBUG("Napi_OpenFile in");
|
||||
|
Loading…
Reference in New Issue
Block a user