From ed8255ba1003f818b292a821eb4651e2443d1e8d Mon Sep 17 00:00:00 2001 From: li-tiangang4 Date: Thu, 29 Feb 2024 18:37:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=92=E6=8B=94=E9=BC=A0?= =?UTF-8?q?=E6=A0=87dinput=20crash=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-tiangang4 --- common/include/input_hub.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index f6ec660..8c1b0ff 100644 --- a/common/include/input_hub.cpp +++ b/common/include/input_hub.cpp @@ -140,9 +140,10 @@ void InputHub::ScanAndRecordInputDevices() openingDevices_.pop_back(); DHLOGI("Reporting device opened: path=%s, name=%s\n", device->path.c_str(), device->identifier.name.c_str()); + std::string devPath = device->path; auto [dev_it, inserted] = devices_.insert_or_assign(device->path, std::move(device)); if (!inserted) { - DHLOGI("Device with this path %s exists, replaced. \n", device->path.c_str()); + DHLOGI("Device with this path %s exists, replaced. \n", devPath.c_str()); } } } @@ -387,9 +388,10 @@ size_t InputHub::DeviceIsExists(InputDeviceEvent *buffer, size_t bufferSize) event->deviceInfo = device->identifier; event += 1; + std::string devPath = device->path; auto [dev_it, inserted] = devices_.insert_or_assign(device->path, std::move(device)); if (!inserted) { - DHLOGI("Device path %s exists, replaced.", device->path.c_str()); + DHLOGI("Device path %s exists, replaced.", devPath.c_str()); } if (capacity == 0) { break; -- Gitee