Skip to content

[Android] Add defensive not null check to SearchHandlerAppearanceTracker.FocusChange #29939

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Transis-Felipe
Copy link

@Transis-Felipe Transis-Felipe commented Jun 11, 2025

Check if _editText is null before detaching the event.

Check if _editText is null before detaching the event.
@Transis-Felipe Transis-Felipe requested a review from a team as a code owner June 11, 2025 17:41
Copy link
Contributor

Hey there @@Transis-Felipe! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jun 11, 2025
@jsuarezruiz jsuarezruiz added platform/android area-controls-shell Shell Navigation, Routes, Tabs, Flyout labels Jun 12, 2025
@@ -270,6 +270,9 @@ protected virtual void Dispose(bool disposing)
if (_searchHandler != null)
{
_searchHandler.PropertyChanged -= SearchHandlerPropertyChanged;
}
if (_editText != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM! Did you find a related issue? Can you describe the steps to reproduce it? I'd like to include a relevant test with the changes.

Copy link
Author

@Transis-Felipe Transis-Felipe Jun 12, 2025

Choose a reason for hiding this comment

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

@jsuarezruiz No, I don't find a direct issue related to this.

I was just investigating to see if I can find the reason of other leaks and found this.

It's just a defensive check to ensure that the _editText is not null before attempting to remove it from the FocusChange event.

@Transis-Felipe Transis-Felipe changed the title Update SearchHandlerAppearanceTracker.cs Add defensive not null check to Android SearchHandlerAppearanceTracker.FocusChange Jun 12, 2025
@Transis-Felipe Transis-Felipe changed the title Add defensive not null check to Android SearchHandlerAppearanceTracker.FocusChange [Android] Add defensive not null check to SearchHandlerAppearanceTracker.FocusChange Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout community ✨ Community Contribution platform/android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants