fix: add lock protection when writing description members of remote objects

Signed-off-by: zhang <zhangfengxi@huawei.com>
This commit is contained in:
zhang
2022-05-25 16:53:44 +08:00
parent d9d7ac40bf
commit 641bddfb88
+2
View File
@@ -141,6 +141,8 @@ bool HdfRemoteServiceHolder::SetInterfaceDescriptor(const char *desc)
HDF_LOGE("failed to set interface des, error on cover str8 to str16, %{public}s", desc);
return false;
}
static std::mutex descMutex;
std::lock_guard<std::mutex> lock(descMutex);
(const_cast<std::u16string *>(&remote_->descriptor_))->assign(newDesc);
return true;