From d3e8ff7128695c0adc7ac7c25502f354aeff03ed Mon Sep 17 00:00:00 2001 From: zhirenx Date: Fri, 11 Feb 2022 15:21:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3inner=20kit?= =?UTF-8?q?=E5=B5=8C=E5=A5=97=E8=B0=83=E7=94=A8=E5=AF=BC=E8=87=B4deadlock?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhirenx Change-Id: Ic71f215f6d7abf66caf21bbe7d76be49bf7c7e3a --- .../device_security_level_callback_helper.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/interfaces/inner_api/src/standard/device_security_level_callback_helper.cpp b/interfaces/inner_api/src/standard/device_security_level_callback_helper.cpp index 8402ebb..5d963ea 100644 --- a/interfaces/inner_api/src/standard/device_security_level_callback_helper.cpp +++ b/interfaces/inner_api/src/standard/device_security_level_callback_helper.cpp @@ -123,14 +123,18 @@ bool DeviceSecurityLevelCallbackHelper::CallbackInfoHolder::PushCallback(const D bool DeviceSecurityLevelCallbackHelper::CallbackInfoHolder::PopCallback(uint32_t cookie, uint32_t result, uint32_t level) { - std::lock_guard lock(mutex_); - auto iter = map_.find(cookie); - if (iter == map_.end()) { - return false; + DeviceIdentify identity; + ResultCallback callback; + { + std::lock_guard lock(mutex_); + auto iter = map_.find(cookie); + if (iter == map_.end()) { + return false; + } + identity = iter->second.identity; + callback = iter->second.callback; + map_.erase(iter); } - DeviceIdentify identity = iter->second.identity; - ResultCallback callback = iter->second.callback; - map_.erase(iter); if (callback != nullptr) { auto creator = [result, level]() { -- Gitee From 7fce7b9168cd26665fd9393660c57558a815021e Mon Sep 17 00:00:00 2001 From: zhirenx Date: Fri, 11 Feb 2022 16:30:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9destpath=E6=8B=BC?= =?UTF-8?q?=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhirenx Change-Id: Ie12e948adfc1b8442b690befbad924a5673a1865 --- bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle.json b/bundle.json index d514e0c..874cc63 100644 --- a/bundle.json +++ b/bundle.json @@ -5,7 +5,7 @@ "license": "Apache License 2.0", "publishAs": "code-segment", "segment": { - "destpath": "base/security/device_security_level" + "destPath": "base/security/device_security_level" }, "dirs": {}, "scripts": {}, -- Gitee