diff --git a/services/ims/input_event_client_proxy.cpp b/services/ims/input_event_client_proxy.cpp index fe5486b3a157fe7cb9f0c2901f82caccc4914cd0..900b1a5f29c0ab21602b4b66588e88cddbe91a42 100644 --- a/services/ims/input_event_client_proxy.cpp +++ b/services/ims/input_event_client_proxy.cpp @@ -45,9 +45,11 @@ void InputEventClientProxy::ClientRequestHandle(int funcId, void* origin, IpcIo* void InputEventClientProxy::AddListener(const void* origin, IpcIo* req, IpcIo* reply) { if (clientInfoMap_.size() >= MAX_CLIENT_SIZE) { + pthread_mutex_unlock(&lock_); GRAPHIC_LOGE("Exceeded the maximum number!"); return; } + pthread_mutex_unlock(&lock_); pid_t pid = GetCallingPid(); SvcIdentity svc = {0}; bool ret = ReadRemoteObject(req, &svc); @@ -76,12 +78,14 @@ void InputEventClientProxy::DeathCallback(void* origin) void InputEventClientProxy::RemoveListener(const void* origin, IpcIo* req, IpcIo* reply) { pid_t pid = GetCallingPid(); + pthread_mutex_lock(&lock_); if (clientInfoMap_.count(pid) > 0) { ReleaseSvc(clientInfoMap_[pid].svc); pthread_mutex_lock(&lock_); clientInfoMap_.erase(pid); pthread_mutex_unlock(&lock_); } + pthread_mutex_unlock(&lock_); } void InputEventClientProxy::OnRawEvent(const RawEvent& event)