Skip to content

Commit c98f192

Browse files
authored
FIX: ObjectDisposedException regression when deleting actions maps (ISXB-831) (#1901)
* Original bug fix retrieved propertyPath from cached SerializedProperty, but in this scenario underlying Property has been disposed * Updated the fix to instead cache propertyPath during initialization when SerializedProperty is valid
1 parent a064203 commit c98f192

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ however, it has to be formatted properly to pass verification tests.
1313
### Fixed
1414
- Physical keyboards used on Android/ChromeOS could have keys "stuck" reporting as pressed after a long press and release [ISXB-475](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-475).
1515
- NullReferenceException thrown when right-clicking an empty Action Map list in Input Actions Editor windows [ISXB-833](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-833).
16+
- Fixed an issue where `System.ObjectDisposedException` would be thrown when deleting the last ActionMap item in the Input Actions Asset editor.
1617

1718
## [1.8.1] - 2024-03-14
1819

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputAction.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public SerializedInputAction(SerializedProperty serializedProperty)
1818
type = (InputActionType)serializedProperty.FindPropertyRelative(nameof(InputAction.m_Type)).intValue;
1919
interactions = serializedProperty.FindPropertyRelative(nameof(InputAction.m_Interactions)).stringValue;
2020
processors = serializedProperty.FindPropertyRelative(nameof(InputAction.m_Processors)).stringValue;
21+
propertyPath = wrappedProperty.propertyPath;
2122
initialStateCheck = ReadInitialStateCheck(serializedProperty);
2223
actionTypeTooltip = serializedProperty.FindPropertyRelative(nameof(InputAction.m_Type)).GetTooltip();
2324
expectedControlTypeTooltip = serializedProperty.FindPropertyRelative(nameof(InputAction.m_ExpectedControlType)).GetTooltip();
@@ -29,6 +30,7 @@ public SerializedInputAction(SerializedProperty serializedProperty)
2930
public InputActionType type { get; }
3031
public string interactions { get; }
3132
public string processors { get; }
33+
public string propertyPath { get; }
3234
public bool initialStateCheck { get; }
3335
public string actionTypeTooltip { get; }
3436
public string expectedControlTypeTooltip { get; }
@@ -60,7 +62,7 @@ public bool Equals(SerializedInputAction other)
6062
&& initialStateCheck == other.initialStateCheck
6163
&& actionTypeTooltip == other.actionTypeTooltip
6264
&& expectedControlTypeTooltip == other.expectedControlTypeTooltip
63-
&& wrappedProperty.propertyPath == other.wrappedProperty.propertyPath;
65+
&& propertyPath == other.propertyPath;
6466
}
6567

6668
public override bool Equals(object obj)
@@ -79,7 +81,7 @@ public override int GetHashCode()
7981
hashCode.Add(initialStateCheck);
8082
hashCode.Add(actionTypeTooltip);
8183
hashCode.Add(expectedControlTypeTooltip);
82-
hashCode.Add(wrappedProperty.propertyPath);
84+
hashCode.Add(propertyPath);
8385
return hashCode.ToHashCode();
8486
}
8587
}

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputBinding.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public SerializedInputBinding(SerializedProperty serializedProperty)
2424
interactions = serializedProperty.FindPropertyRelative("m_Interactions").stringValue;
2525
processors = serializedProperty.FindPropertyRelative("m_Processors").stringValue;
2626
action = serializedProperty.FindPropertyRelative("m_Action").stringValue;
27+
propertyPath = wrappedProperty.propertyPath;
2728
var bindingGroups = serializedProperty.FindPropertyRelative(nameof(InputBinding.m_Groups)).stringValue;
2829
controlSchemes = bindingGroups != null
2930
? bindingGroups.Split(InputBinding.kSeparatorString, StringSplitOptions.RemoveEmptyEntries)
@@ -44,6 +45,7 @@ public SerializedInputBinding(SerializedProperty serializedProperty)
4445
public string interactions { get; }
4546
public string processors { get; }
4647
public string action { get; }
48+
public string propertyPath { get; }
4749
public string[] controlSchemes { get; }
4850
public InputBinding.Flags flags { get; }
4951

@@ -88,7 +90,7 @@ public bool Equals(SerializedInputBinding other)
8890
&& isPartOfComposite == other.isPartOfComposite
8991
&& compositePath == other.compositePath
9092
&& controlSchemes.SequenceEqual(other.controlSchemes)
91-
&& wrappedProperty.propertyPath == other.wrappedProperty.propertyPath;
93+
&& propertyPath == other.propertyPath;
9294
}
9395

9496
public override bool Equals(object obj)
@@ -110,7 +112,7 @@ public override int GetHashCode()
110112
hashCode.Add(isPartOfComposite);
111113
hashCode.Add(compositePath);
112114
hashCode.Add(controlSchemes);
113-
hashCode.Add(wrappedProperty.propertyPath);
115+
hashCode.Add(propertyPath);
114116
return hashCode.ToHashCode();
115117
}
116118
}

0 commit comments

Comments
 (0)