diff --git a/services/distributeddataservice/app/src/kvstore_resultset_impl.cpp b/services/distributeddataservice/app/src/kvstore_resultset_impl.cpp index dac0507790f275288e7ba79302eef60fd8093653..36e0bb4598c174e974d4fd7500394dfc96f7ecb6 100755 --- a/services/distributeddataservice/app/src/kvstore_resultset_impl.cpp +++ b/services/distributeddataservice/app/src/kvstore_resultset_impl.cpp @@ -188,7 +188,7 @@ Status KvStoreResultSetImpl::CloseResultSet(DistributedDB::KvStoreNbDelegate *kv return Status::INVALID_ARGUMENT; } DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); - std::shared_lock lock(this->mutex_); + std::unique_lock lock(this->mutex_); DistributedDB::DBStatus status = kvStoreNbDelegate->CloseResultSet(kvStoreResultSet_); if (status != DistributedDB::DBStatus::OK) { return Status::DB_ERROR; diff --git a/services/distributeddataservice/app/src/single_kvstore_impl.cpp b/services/distributeddataservice/app/src/single_kvstore_impl.cpp index affe516627880f3ab296d3c610d9942bbd1ffdb1..c67beddd1e9313c9f732f11a03038b6b7b582901 100755 --- a/services/distributeddataservice/app/src/single_kvstore_impl.cpp +++ b/services/distributeddataservice/app/src/single_kvstore_impl.cpp @@ -1448,6 +1448,7 @@ Status SingleKvStoreImpl::SetCapabilityRange(const std::vector &loc Status SingleKvStoreImpl::GetSecurityLevel(SecurityLevel &securityLevel) { + std::shared_lock lock(storeNbDelegateMutex_); if (kvStoreNbDelegate_ == nullptr) { return Status::STORE_NOT_OPEN; }