Unity-Technologies / InputSystem

An efficient and versatile input system for Unity.
Other
1.43k stars 310 forks source link

FIX: ObjectDisposedException regression when deleting actions maps (ISXB-831) #1901

Closed timkeo closed 6 months ago

timkeo commented 6 months ago

Description

Fixes regression introduced with this bug fix: https://github.com/Unity-Technologies/InputSystem/pull/1861

The original fix added propertyPath to the SerializedInputAction/Binding Equals method, but it retrieved the value directly from the cached SerializedProperty. In this scenario (deleting last ActionMap) the underlying Property is disposed and causes this exception. Instead, this change saves propertyPath to a separate string during initialization when the SerializedProperty is known to be valid.

Changes made

Added a propertyPath property to SerializedInputAction/Binding which holds the value retrieved from wrappedProperty. This string is used during Equals() method.

Notes

I verified this change doesn't break https://jira.unity3d.com/browse/ISX-1873 but there's still a small concern about caching propertyPath. If the it changes in the underlying Property it won't be updated here. But I don't think this is a real problem given how this struct is used.

Checklist

Before review:

During merge: