[PATCH 2/5] dinput: Hold the HID joystick CS when updating the device state.
Rémi Bernon
rbernon at codeweavers.com
Fri Oct 8 08:13:50 CDT 2021
The read buffer is only used by the reading thread but the device state
is not, we should only update it while holding the CS.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/dinput/joystick_hid.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 208e73835e9..64eae772381 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -1495,6 +1495,7 @@ static HRESULT hid_joystick_read_state( IDirectInputDevice8W *iface )
}
}
+ EnterCriticalSection( &impl->base.crit );
do
{
count = impl->usages_count;
@@ -1530,6 +1531,7 @@ static HRESULT hid_joystick_read_state( IDirectInputDevice8W *iface )
memset( &impl->read_ovl, 0, sizeof(impl->read_ovl) );
impl->read_ovl.hEvent = impl->base.read_event;
} while (ReadFile( impl->device, report_buf, report_len, &count, &impl->read_ovl ));
+ LeaveCriticalSection( &impl->base.crit );
return DI_OK;
}
--
2.33.0
More information about the wine-devel
mailing list