From fd5668e508da60d557bfbbd66c41d040ed8b49dc Mon Sep 17 00:00:00 2001 From: zhang_hao_zheng Date: Thu, 29 Jan 2026 11:26:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DblackList=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=91=BD=E5=90=8D=E6=AD=A7=E4=B9=89=E5=B9=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BA=BF=E7=A8=8B=E5=AE=89=E5=85=A8=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将变量名从blackList改为blocklist,消除命名歧义 - 在extensionBlocklist_.emplace处添加mutex锁保护 - 添加break语句避免不必要的循环 Signed-off-by: zhang_hao_zheng --- frameworks/native/ability/native/extension_config_mgr.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frameworks/native/ability/native/extension_config_mgr.cpp b/frameworks/native/ability/native/extension_config_mgr.cpp index ce9ebf8f7b..469cdcc65a 100644 --- a/frameworks/native/ability/native/extension_config_mgr.cpp +++ b/frameworks/native/ability/native/extension_config_mgr.cpp @@ -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::lock_guard lock(extensionBlockListMutex_); extensionBlocklist_.emplace(type, std::move(currentBlockList)); currentBlockList.clear(); + break; } inFile.close(); }