Skip to content

Commit 573f4ff

Browse files
authored
FIX: Make sure InputEventPtr is valid when marking it as handled (#1601)
1 parent cc33939 commit 573f4ff

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ however, it has to be formatted properly to pass verification tests.
1414
- Fixed `ArgumentNullException` when opening the Prefab Overrides window and selecting a component with an `InputAction`.
1515
- Fixed `{fileID: 0}` getting appended to `ProjectSettings.asset` file when building a project ([case ISXB-296](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-296)).
1616
- Fixed `Type of instance in array does not match expected type` assertion when using PlayerInput in combination with Control Schemes and Interactions ([case ISXB-282](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-282)).
17+
- Fixed an InvalidOperationException when using Hold interaction, and by extension any interaction that changes to performed state after a timeout ([case ISXB-332](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-330)).
1718

1819
## [1.4.3] - 2022-09-23
1920

Packages/com.unity.inputsystem/InputSystem/Actions/InputActionState.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,11 @@ private void ChangePhaseOfActionInternal(int actionIndex, TriggerState* actionSt
24032403
// When we perform an action, we mark the event handled such that FireStateChangeNotifications()
24042404
// can then reset state monitors in the same group.
24052405
// NOTE: We don't consume for controls at binding complexity 1. Those we fire in unison.
2406-
if (controlGroupingAndComplexity[trigger.controlIndex * 2 + 1] > 1)
2406+
if (controlGroupingAndComplexity[trigger.controlIndex * 2 + 1] > 1 &&
2407+
// we can end up switching to performed state from an interaction with a timeout, at which point
2408+
// the original event will probably have been removed from memory, so make sure to check
2409+
// we still have one
2410+
m_CurrentlyProcessingThisEvent.valid)
24072411
m_CurrentlyProcessingThisEvent.handled = true;
24082412
}
24092413
else if (newPhase == InputActionPhase.Canceled)

0 commit comments

Comments
 (0)