Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit a5e9894

Browse files
committed
Bug fix: XOutputDevice.RefreshInput() is not thread safe.
1 parent a610e2f commit a5e9894

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

XOutput/Devices/XInput/XOutputDevice.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public sealed class XOutputDevice : IDevice
4343
private readonly InputMapper mapper;
4444
private readonly DPadDirection[] dPads = new DPadDirection[DPadCount];
4545
private readonly XOutputSource[] sources;
46-
private readonly DeviceState state;
4746
private DeviceInputChangedEventArgs deviceInputChangedEventArgs;
4847

4948
/// <summary>
@@ -55,7 +54,6 @@ public XOutputDevice(InputMapper mapper)
5554
{
5655
this.mapper = mapper;
5756
sources = XInputHelper.Instance.GenerateSources();
58-
state = new DeviceState(sources, DPadCount);
5957
deviceInputChangedEventArgs = new DeviceInputChangedEventArgs(this);
6058
}
6159

@@ -108,7 +106,7 @@ private void SourceInputChanged(object sender, DeviceInputChangedEventArgs e)
108106
/// <returns>if the input was available</returns>
109107
public bool RefreshInput(bool force = false)
110108
{
111-
state.ResetChanges();
109+
DeviceState state = new DeviceState(sources, DPadCount);
112110
foreach (var s in sources)
113111
{
114112
if (s.Refresh(mapper))

0 commit comments

Comments
 (0)