From 42731a992e7bf1ee2d6decc1dd1434f02eed3330 Mon Sep 17 00:00:00 2001 From: morg Date: Sat, 14 Oct 2023 13:42:28 +0200 Subject: [PATCH] HyperXMicrophoneController: avoid race condition, fixes a crash on rescan. --- .../HyperXMicrophoneController/HyperXMicrophoneController.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Controllers/HyperXMicrophoneController/HyperXMicrophoneController.cpp b/Controllers/HyperXMicrophoneController/HyperXMicrophoneController.cpp index 6d2e24b3..41de8ee0 100644 --- a/Controllers/HyperXMicrophoneController/HyperXMicrophoneController.cpp +++ b/Controllers/HyperXMicrophoneController/HyperXMicrophoneController.cpp @@ -34,10 +34,14 @@ HyperXMicrophoneController::HyperXMicrophoneController(hidapi_wrapper hid_wrappe HyperXMicrophoneController::~HyperXMicrophoneController() { + lock.lock(); + if(dev) { wrapper.hid_close(dev); } + + lock.unlock(); } std::string HyperXMicrophoneController::GetDeviceLocation()