diff options
| author | JosJuice <josjuice@gmail.com> | 2025-07-30 21:49:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-30 21:49:23 +0200 |
| commit | 62bc93473fe4457d9cf9a7016fc9fb14a5159729 (patch) | |
| tree | f6d5dc4006fd058d3e2c2091796acc61322d96bc /Source/Core/InputCommon/ControllerInterface | |
| parent | d6a4421386850c9fe6a834bc451bca9b90ba0a98 (diff) | |
| parent | c613d3ca109a437e5001aa86c7839f494345818f (diff) | |
Merge pull request #13781 from Dentomologist/controllerinterface_fix_windows_deadlock
ControllerInterface: Fix Windows deadlock
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp index 2e69fc80e6..79584913cf 100644 --- a/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp @@ -10,8 +10,6 @@ #include <hidclass.h> -#include <mutex> - #include "Common/Flag.h" #include "Common/Logging/Log.h" #include "InputCommon/ControllerInterface/DInput/DInput.h" @@ -20,7 +18,6 @@ #pragma comment(lib, "OneCoreUAP.Lib") -static std::mutex s_populate_mutex; // TODO is this really needed? static Common::Flag s_first_populate_devices_asked; static HCMNOTIFICATION s_notify_handle; @@ -52,7 +49,6 @@ _Pre_satisfies_(EventDataSize >= sizeof(CM_NOTIFY_EVENT_DATA)) static DWORD CALL // listen for it. if (s_first_populate_devices_asked.IsSet()) { - std::lock_guard lk_population(s_populate_mutex); // TODO: we could easily use the message passed alongside this event, which tells // whether a device was added or removed, to avoid removing old, still connected, devices g_controller_interface.PlatformPopulateDevices([&] { @@ -96,17 +92,18 @@ InputBackend::InputBackend(ControllerInterface* controller_interface) void InputBackend::PopulateDevices() { - std::lock_guard lk_population(s_populate_mutex); - s_first_populate_devices_asked.Set(); - ciface::DInput::PopulateDevices(GetHWND()); - ciface::XInput::PopulateDevices(); - ciface::WGInput::PopulateDevices(); + g_controller_interface.PlatformPopulateDevices([this] { + s_first_populate_devices_asked.Set(); + ciface::DInput::PopulateDevices(GetHWND()); + ciface::XInput::PopulateDevices(); + ciface::WGInput::PopulateDevices(); + }); } void InputBackend::HandleWindowChange() { - std::lock_guard lk_population(s_populate_mutex); - ciface::DInput::ChangeWindow(GetHWND()); + g_controller_interface.PlatformPopulateDevices( + [this] { ciface::DInput::ChangeWindow(GetHWND()); }); } InputBackend::~InputBackend() |
