FIX: Fixed potential crash on Mac when using stale references to deleted InputDevice objects (case ISXB-606) #2009
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A user reported that the Editor sometimes crashed on Mac when running (their) tests in the Editor's TestRunner window
This PR addresses the root cause of the problem: stale object references were resulting in the input system accessing somewhat random memory addresses to read device state.
Some random memory address access can cause the Mac OS kernel to terminate the application instead of returning an exception to the process (this does not appear to happen on Windows).
Changes made
Added deviceIndex checks when accessing InputStateBuffers.DoubleBuffers front and back buffers to avoid reading random memory.
Testing
Local testing of the user's supplied reproduction project.
Risk
Minimal risks - these changes prevent access to essentially random memory addresses when reading device state.
Checklist
Changed
,Fixed
,Added
sections.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: