Skip to content

Conversation

@Renzo-Olivares
Copy link
Contributor

@Renzo-Olivares Renzo-Olivares commented Nov 27, 2025

This change fixes a crash in EditableText that occurs when the text editing value changes between two scrolls, when the second scroll ends _dataWhenToolbarShowScheduled will be invalidated. If the second scroll ends before the post frame callback scheduled by the first scroll has a chance to execute, there will be a crash because _dataWhenToolbarShowScheduled is being accessed while null.

This change also invalidates a scheduled toolbar if the text editing value has changed before the post-frame callback has a chance to run.

Fixes #179164

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], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Nov 27, 2025
@github-actions github-actions bot added f: material design flutter/packages/flutter/material repository. f: cupertino flutter/packages/flutter/cupertino repository labels Dec 1, 2025
@Renzo-Olivares Renzo-Olivares force-pushed the editabletext-crash-on-scroll-fix branch from ecfdb6b to 109e411 Compare December 1, 2025 20:02
@Renzo-Olivares Renzo-Olivares marked this pull request as ready for review December 1, 2025 20:16
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍

One nit: Are you sure it's worth it to include tests for TextField and CupertinoTextField, or do the tests on EditableText cover everything already?

@Renzo-Olivares
Copy link
Contributor Author

@justinmc I wasn't too sure about this. My reasoning was that while the EditableText test does cover the general behavior and bug, the material/cupertino specific tests might still be valuable in that they test the EditableText interaction within their own "material" and "cupertino" specific environment and components (context menus in this case). I don't feel too strongly about whether we should include it, what are your thoughts on this?

@loic-sharma
Copy link
Member

I personally lean towards repeating the test in the Cupertino and Material libraries. The main drawback is increased maintenance burden, but in this case the increased burden appears to be acceptable. I don't feel strongly about this though and would be happy to defer to whatever y'all think is best :)

@justinmc
Copy link
Contributor

justinmc commented Dec 2, 2025

I'm on board with keeping the duplicated tests! Seems like the bug was reported in TextField so it's probably good to have a specific regression test for that, among the other reasons you guys gave above.

@Renzo-Olivares Renzo-Olivares added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 2, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Dec 2, 2025
Merged via the queue into flutter:master with commit 102cde6 Dec 2, 2025
71 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 2, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Dec 3, 2025
flutter/flutter@5545bb3...e274574

2025-12-03 [email protected] Roll Skia from 20829e37dfb8 to db4c79d41513 (1 revision) (flutter/flutter#179401)
2025-12-03 [email protected] Roll Skia from adc7ea94cada to 20829e37dfb8 (6 revisions) (flutter/flutter#179385)
2025-12-03 [email protected] Refactor GetShaderClipDepth for clarity (flutter/flutter#179110)
2025-12-03 [email protected] Roll Skia from 3b339a83959b to adc7ea94cada (1 revision) (flutter/flutter#179376)
2025-12-03 [email protected] Roll Dart SDK from eb743a1d4ade to 0bb365d7ac74 (7 revisions) (flutter/flutter#179372)
2025-12-03 [email protected] feat: Add `mainAxisExtent` parameter to `GridView` constructors (flutter/flutter#176927)
2025-12-03 [email protected] Roll Skia from eb01fff20df8 to 3b339a83959b (4 revisions) (flutter/flutter#179371)
2025-12-02 [email protected] Fix crash when text editing value changes between scrolls (flutter/flutter#179163)
2025-12-02 [email protected] Roll Skia from 6bd3b06b1e08 to eb01fff20df8 (3 revisions) (flutter/flutter#179362)
2025-12-02 [email protected] Adds Impellerc flatbuffer format versioning. (flutter/flutter#175470)
2025-12-02 [email protected] Adds format argument to Picture.toImageSync (flutter/flutter#178691)
2025-12-02 [email protected] Delete disabled workflow and add missing permissions key to workflow (flutter/flutter#178911)
2025-12-02 [email protected] [web] Fix some gn warnings (flutter/flutter#178313)
2025-12-02 [email protected] Roll Skia from 45337c4e919d to 6bd3b06b1e08 (4 revisions) (flutter/flutter#179353)
2025-12-02 [email protected] [ios] Reland Dynamic Content Resizing (flutter/flutter#179153)
2025-12-02 [email protected] [web] Fix onTextScaleFactorChanged not getting called. (flutter/flutter#178862)
2025-12-02 [email protected] Roll Packages from c8be05d to 148dcd2 (9 revisions) (flutter/flutter#179343)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…9163)

This change fixes a crash in `EditableText` that occurs when the text
editing value changes between two scrolls, when the second scroll ends
`_dataWhenToolbarShowScheduled` will be invalidated. If the second
scroll ends before the post frame callback scheduled by the first scroll
has a chance to execute, there will be a crash because
`_dataWhenToolbarShowScheduled` is being accessed while null.

This change also invalidates a scheduled toolbar if the text editing
value has changed before the post-frame callback has a chance to run.

Fixes flutter#179164

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

---------

Co-authored-by: Renzo Olivares <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems f: cupertino flutter/packages/flutter/cupertino repository f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EditableText crashes when text editing value changes between consecutive scrolls

3 participants