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

Bug fix: XOutputDevice.RefreshInput() is not thread safe. #818

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions XOutput/Devices/XInput/XOutputDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public sealed class XOutputDevice : IDevice
private readonly InputMapper mapper;
private readonly DPadDirection[] dPads = new DPadDirection[DPadCount];
private readonly XOutputSource[] sources;
private readonly DeviceState state;
private DeviceInputChangedEventArgs deviceInputChangedEventArgs;

/// <summary>
Expand All @@ -55,7 +54,6 @@ public XOutputDevice(InputMapper mapper)
{
this.mapper = mapper;
sources = XInputHelper.Instance.GenerateSources();
state = new DeviceState(sources, DPadCount);
deviceInputChangedEventArgs = new DeviceInputChangedEventArgs(this);
}

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