Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug when blur command received on node without XamlRoot #12051

Merged
merged 2 commits into from
Aug 29, 2023

Conversation

rozele
Copy link
Collaborator

@rozele rozele commented Aug 21, 2023

Description

Type of Change

Erase all that don't apply.

  • Bug fix (non-breaking change which fixes an issue)

Why

We are seeing crashes on quit when the blur command is called roughly around the same time that the React instance is being shut down. It's likely because the result of tryGetXamlRoot is null.

What

This change falls back on the GetFocusedElement() overload without any parameters if the XamlRoot is null, as supplying a null parameter will result in a NPE.

Testing

It's a tricky race condition to repro, but I did validate that passing a null XamlRoot value to FocusManager::GetFocusedElement(XamlRoot) will throw an exception.

Changelog

Should this change be included in the release notes: yes

Fix for NPE when blur command is received while React instance is shutting down.

Microsoft Reviewers: Open in CodeFlow

@rozele rozele requested a review from a team as a code owner August 21, 2023 17:04
We are seeing crashes on quit when the blur command is called roughly
around the same time that the React instance is being shut down. It's
likely because the result of tryGetXamlRoot is null.

This change falls back on the GetFocusedElement() overload without any
parameters if the XamlRoot is null, as supplying a null parameter will
result in a NPE.
Copy link
Contributor

@chiaramooney chiaramooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jonthysell jonthysell merged commit 97a386c into microsoft:main Aug 29, 2023
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants