mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-27 21:30:06 -04:00
fix: 修复blackList变量命名歧义并添加线程安全保护
- 将变量名从blackList改为blocklist,消除命名歧义 - 在extensionBlocklist_.emplace处添加mutex锁保护 - 添加break语句避免不必要的循环 Signed-off-by: zhang_hao_zheng <zhanghaozheng2@h-partners.com>
This commit is contained in:
@@ -68,16 +68,18 @@ void ExtensionConfigMgr::LoadExtensionBlockList(const std::string &extensionName
|
||||
if (item.key() != extensionName) {
|
||||
continue;
|
||||
}
|
||||
if (!blackList[item.key()].is_array()) {
|
||||
if (!blocklist[item.key()].is_array()) {
|
||||
continue;
|
||||
}
|
||||
for (const auto& value : blackList[item.key()]) {
|
||||
for (const auto& value : blocklist[item.key()]) {
|
||||
if (value.is_string()) {
|
||||
currentBlockList.emplace(value.get<std::string>());
|
||||
}
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(extensionBlockListMutex_);
|
||||
extensionBlocklist_.emplace(type, std::move(currentBlockList));
|
||||
currentBlockList.clear();
|
||||
break;
|
||||
}
|
||||
inFile.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user