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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

{
_editText.FocusChange -= EditTextFocusChange;
}
_searchHandler = null;
Expand All @@ -282,4 +285,4 @@ public void Dispose()
Dispose(true);
}
}
}
}