From e2d6bc660239ead8d46f83712a5f6e9630e8e6d4 Mon Sep 17 00:00:00 2001 From: zhaolinglan Date: Tue, 19 Jul 2022 20:16:58 +0800 Subject: [PATCH] modify for build error Signed-off-by: zhaolinglan --- .../src/js_input_method_engine_listener.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_listener.cpp b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_listener.cpp index a8c74039..62c1af5e 100644 --- a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_listener.cpp +++ b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_listener.cpp @@ -34,13 +34,11 @@ namespace MiscServices { void JsInputMethodEngineListener::AddCallback(std::string type, NativeValue* jsListenerObject) { IMSA_HILOGI("JsInputMethodEngineListener::AddCallback is called : %{public}s", type.c_str()); - { - std::lock_guard lock(mMutex); - std::shared_ptr callbackRef(engine_->CreateReference(jsListenerObject, 1)); - if (callbackRef == nullptr) { - IMSA_HILOGI("JsInputMethodEngineListener::AddCallback fail, callbackRef is nullptr."); - return; - } + std::lock_guard lock(mMutex); + std::shared_ptr callbackRef(engine_->CreateReference(jsListenerObject, 1)); + if (callbackRef == nullptr) { + IMSA_HILOGI("JsInputMethodEngineListener::AddCallback fail, callbackRef is nullptr."); + return; } std::lock_guard lk(mapMutex); jsCbMap_[type].push_back(callbackRef);