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 iOS text selection crash by returning nil range #55909

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

importRyan
Copy link

@importRyan importRyan commented Oct 16, 2024

Reverts a runtime crashing assertion introduced by #16496. Defensively favors returning a nil text selection range rather than crash. See issue #138464 for crash reports and reproduction recordings.

Without this revert, to avoid a crash hit in a minority of user interactions with a text field, we must degrade experiences for all users by disabling useful iOS text field behaviors (see #138464 for workarounds).

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Fix iOS text selection crash by returning nil range

@importRyan importRyan marked this pull request as ready for review October 16, 2024 21:06
@chinmaygarde
Copy link
Member

cc @justinmc

@importRyan
Copy link
Author

@chinmaygarde Thanks for that bump. Is there a chance at getting this in the review queue soon?

This assertion is one of our most common crashes. Simply deselecting the text on some touches (this PR) is preferable to tossing the whole app session out.

If there's desire to fix the upstream range finding, that makes sense, but we'd love to save that for focused follow-on where there's a test battery.

@jmagman
Copy link
Member

jmagman commented Oct 28, 2024

@hellohuanlin can you take a look? My concern is that this regresses #16496 and b/149077991, in which case we need a different solution.
flutter/flutter#138464 (comment)

@jmagman jmagman requested a review from hellohuanlin October 28, 2024 19:58
@importRyan
Copy link
Author

Honest question: is a regression possible?

Sessions that currently crash will simply now continue, allowing VO/non-VO users to retry input strategies. #16496 stopped a crash when using VoiceOver in a provided sample app. That sample does not crash now.

Thanks for analyzing this and getting it in the queue!

Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

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

Honest question: is a regression possible?

Should be safe since it's removing NSAssert

@jmagman
Copy link
Member

jmagman commented Nov 4, 2024

Should be safe since it's removing NSAssert

@hellohuanlin NSAsserts are on in release mode in Flutter flutter/flutter#157837 (cbracken mentioned he wanted to fix that)

@jmagman
Copy link
Member

jmagman commented Nov 4, 2024

Formatting issue
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8732309981621212289/+/u/test:_test:_Check_formatting/stdout

@jmagman jmagman requested a review from cbracken November 6, 2024 22:09
@chinmaygarde
Copy link
Member

@cbracken @jmagman Are we still making progress on this one?

@chinmaygarde chinmaygarde added the Work in progress (WIP) Not ready (yet) for review! label Dec 9, 2024
@gvozditskiy
Copy link

Any progress with this one? Customers aren't very happy with crashes

@importRyan importRyan force-pushed the fix/text-selection-not-found-crashing-assertion branch from 275c59f to a3d596a Compare December 19, 2024 01:08
@importRyan
Copy link
Author

CI failure is only on mac_android_aot_engine. I don't get a retry option, so I'll push a commit to trigger again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-ios Work in progress (WIP) Not ready (yet) for review!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants