From 00ec25d520f662c5c60d8b8cc9830687c3ce281f Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 13 Dec 2020 00:30:27 +0000 Subject: InputCommon: Fix callback dispatch deadlock Make sure m_is_populating_devices is true when a WM_INPUT_DEVICE_CHANGE event is received directly on the ciface thread, so that callbacks do not occur while removing devices. This breaks a hold-and-wait deadlock between the ciface thread and the CPU thread when using emulated Wiimotes. Co-authored-by: brainleq Co-authored-by: oldmud0 --- Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp index 67a31a062a..096ad31827 100644 --- a/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Win32/Win32.cpp @@ -28,8 +28,10 @@ static LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARA { if (message == WM_INPUT_DEVICE_CHANGE) { - ciface::DInput::PopulateDevices(s_hwnd); - ciface::XInput::PopulateDevices(); + g_controller_interface.PlatformPopulateDevices([] { + ciface::DInput::PopulateDevices(s_hwnd); + ciface::XInput::PopulateDevices(); + }); s_done_populating.Set(); } -- cgit v1.2.3