Repository navigation
Fix null check crash in flushSemantics from a stale ancestor geometry cache - #192724
auto-submit[bot] merged 5 commits into
Conversation
When a semantics boundary becomes invisible and its parent in the semantics tree has dirty geometry, flushSemantics read the parent's firstAncestorNodeWithCleanGeometry without computing it for the current flush. The value could be left over from an earlier flush and point at an ancestor whose geometry has since been cleared, which crashed with a null check in _buildSemanticsSubtree or _updateSemanticsNodeGeometry. Claude-Session: https://claude.ai/code/session_01BpijWyLbQPdBw6XZfKTjNP
|
HI @shinofara Please file an issue for this crash and add |
With a screen reader on, typing a search threw "Null check operator used on a null value" in _updateSemanticsNodeGeometry. Hidden tabs were still resized for the keyboard, and Flutter 3.47 loses track of a hidden branch's semantics when it changes size (flutter/flutter#192724, not yet released). The tabs are now stacked as indexedStack stacks them, but only the one on screen sees the keyboard's insets.
|
Filed #195316 for this, with two symbolized traces from release Android builds (accessibility service on) and a run of this PR's test on stable 3.47.7, where it fails with the same stack. Adding |
There was a problem hiding this comment.
Code Review
This pull request updates PipelineOwner.flushSemantics in object.dart to call computeAncestorInfo on parentInSemanticsTree when its geometry is dirty, preventing the reuse of a stale ancestor geometry cache. It also adds a widget test in semantics_blocked_geometry_test.dart to verify that a node becoming invisible while its branch is blocked does not crash when an ancestor geometry cache is stale. There are no review comments, and I have no feedback to provide.
…m d8a54db1) Flutter 3.47.7 can crash while flushing semantics when a branch behind a modal barrier keeps an ancestor whose geometry was cleared. Add the one-line backport of flutter/flutter#192724 as a patch, a script that applies or verifies it on the pinned SDK, and run it before APK builds. Run `dart scripts/prepare_flutter_sdk.dart` once per fresh Flutter install before testing or building; `--check` verifies without change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WnBFsa3bYxXRBNTXtoBQxh
, Refs #916) Dockerfile.builder applies the object.dart hunk of the unmerged upstream fix flutter/flutter#192724 to Flutter 3.47.0 (flutter/flutter#195316: null check in PipelineOwner.flushSemantics while a page is blocked by a new route). The image build fails when the patch no longer applies. scripts/check_flutter_semantics_patch.sh warns, like the #808 skwasm check, when FLUTTER_VERSION moves or #192724 merges; client gates run it. Co-authored-by: vadim-tabbot <[email protected]>
, Refs #916) Dockerfile.builder applies the object.dart hunk of the unmerged upstream fix flutter/flutter#192724 to Flutter 3.47.0 (flutter/flutter#195316: null check in PipelineOwner.flushSemantics while a page is blocked by a new route). The image build fails when the patch no longer applies. scripts/check_flutter_semantics_patch.sh warns, like the #808 skwasm check, when FLUTTER_VERSION moves or #192724 merges; client gates run it. Co-authored-by: vadim-tabbot <[email protected]>
, Refs #916) Dockerfile.builder applies the object.dart hunk of the unmerged upstream fix flutter/flutter#192724 to Flutter 3.47.0 (flutter/flutter#195316: null check in PipelineOwner.flushSemantics while a page is blocked by a new route). The image build fails when the patch no longer applies. scripts/check_flutter_semantics_patch.sh warns, like the #808 skwasm check, when FLUTTER_VERSION moves or #192724 merges; client gates run it. Co-authored-by: vadim-tabbot <[email protected]>
|
@mbcorona Thanks, and thanks @Lopution for filing #195316. I added This is still unfixed on stable 3.47.9 and on master: the Could someone from team-accessibility take a look? The PR also needs the |
chunhtai
left a comment
There was a problem hiding this comment.
LGTM, just one suggestion
| @@ -1646,6 +1646,9 @@ base class PipelineOwner with DiagnosticableTreeMixin { | |||
| if (!parentInSemanticsTree.geometryDirty) { | |||
There was a problem hiding this comment.
This condition is no longer needed and just run the else branch should be fine.
There was a problem hiding this comment.
Done in facb6b9. computeAncestorInfo sets the cache to the parent itself when its geometry is clean, so the else branch covers both cases. The regression test still passes, and it still fails without the fix.
computeAncestorInfo returns the parent itself when its geometry is clean, so the else branch covers both cases.
da9b0ee to
facb6b9
Compare
…ore tests Design review round 2 found these gaps. Update check - The app ships arm64 only, so the update check no longer reads the device ABIs. When that read failed it returned no ABIs and told an arm64 user that no compatible APK exists. A release's arm64 APK is now offered whenever it has one; noCompatibleApk means the release has none. - Regression test: an arm64 APK is offered without device ABI information (failed before the fix, passes after). Tests - The semantics regression test runs again. It guards the project's Flutter semantics patch (flutter/flutter#192724), which scripts/prepare_flutter_sdk.dart applies; it failed only on an unpatched SDK and passes 3 of 3 on the patched one. - The cover cache burst test again checks the saved index: after close every touched object has its new stamp in the file. - A new album header test covers the title, cover, download action size and collapsing without depending on blur. - Each remaining blur skip states why: they fail at the pre-work commit too and need their own fix. Verified: flutter analyze clean; the six edited files, 40 passed and 14 skipped with reasons. Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_01FWSoKz8YuejwVgMMeXJ2oF
|
autosubmit label was removed for flutter/flutter/192724, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
|
Hi @chunhtai @hannah-hyj, I'm a colleague of @shinofara. Thanks for the reviews!
This crash is affecting a lot of our users in production, so we'd really appreciate it. Thank you! |
flutter/flutter@98744d3...b75c5b3 2026-11-24 [email protected] Roll Skia from 89e364b13f05 to 2140958ee284 (3 revisions) (flutter/flutter#197287) 2026-11-24 [email protected] Roll Skia from f82f3efc0461 to 89e364b13f05 (6 revisions) (flutter/flutter#197284) 2026-11-24 [email protected] Roll Dart SDK from 10aef26c73f5 to 87f515c52de9 (1 revision) (flutter/flutter#197279) 2026-11-24 [email protected] iOS: Drive platform view tests through IOSExternalViewEmbedder (flutter/flutter#197263) 2026-11-24 [email protected] Fix null check crash in flushSemantics from a stale ancestor geometry cache (flutter/flutter#192724) 2026-11-24 [email protected] [Impeller] Fix Windows build with MSVC 14.52: std::modf is [[nodiscard]] (flutter/flutter#193413) 2026-11-24 [email protected] [web] Preserve fill rules from path operations (flutter/flutter#195971) 2026-11-24 [email protected] Regenerate tool_test_durations.json (flutter/flutter#197261) 2026-11-24 [email protected] Roll Skia from 694af434cadd to f82f3efc0461 (4 revisions) (flutter/flutter#197258) 2026-11-24 [email protected] Increase number of 'Linux tool_integration_tests' subshards (flutter/flutter#197262) 2026-11-24 [email protected] Run tool_integration_tests app tests in one subshard instead of all of them (flutter/flutter#197264) 2026-11-24 [email protected] [flutter_tools] Pass featureFlags in localizations_test.dart (flutter/flutter#197269) 2026-11-23 [email protected] Fix Orca flat review in Linux accessibility (flutter/flutter#196338) 2026-11-23 [email protected] [flutter tools] Pass --client-id=flutter-analyze to the analysis server (flutter/flutter#197227) 2026-11-23 [email protected] [Flutter GPU] Expose the maximum render target size (flutter/flutter#196640) 2026-11-23 [email protected] iOS: Don't clear raster thread state in platform views reset (flutter/flutter#197025) 2026-11-23 [email protected] iOS: Composite platform views from layers in tests (flutter/flutter#197021) 2026-11-23 [email protected] [flutter_tools] Harden extension diagnostics models and RPC failure handling (flutter/flutter#196233) 2026-11-23 [email protected] [flutter_tools] Support standalone UI packages in gen-l10n (flutter/flutter#194500) 2026-11-23 [email protected] [flutter_tools] Consolidate ToolDependencies.bootstrap builders and require extension managers (flutter/flutter#196388) 2026-11-23 [email protected] Roll Skia from 31b19bdc8195 to 694af434cadd (2 revisions) (flutter/flutter#197239) 2026-11-23 [email protected] Roll Dart SDK from df632229552e to 10aef26c73f5 (1 revision) (flutter/flutter#197234) 2026-11-23 [email protected] [macOS] Fix back buffer cache returning a wrong-size surface (Impeller null deref in Canvas::SetupRenderPass) (flutter/flutter#192522) 2026-11-23 [email protected] Add Settings::frame_built_callback for UI frame build timings (flutter/flutter#197213) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[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
…docs/done/438.md (#717) Follow-up to #711 (job 438), which fixed PostHog bug 2. This PR is about bug 1: `TypeError: Null check operator used on a null value` in `_RenderObjectSemantics._updateSemanticsNodeGeometry` during `PipelineOwner.flushSemantics`. Docs only. ## What was found - **Cause, upstream.** Bug 1 is [flutter#195316](flutter/flutter#195316). In `flushSemantics`, a node whose geometry turned invisible reads its parent's `firstAncestorNodeWithCleanGeometry` cache without recomputing it. The cache can point at a node whose geometry was cleared in the same flush, and `ensureSemanticsNode()` on that node throws. It needs a branch kept out of the semantics tree (a dialog or sheet barrier, the add sheet's `ExcludeSemantics`, an offstage tab) while the page under it changes. - **Upstream fix.** [flutter#192724](flutter/flutter#192724) merged to Flutter master on 24 Nov 2026. Neither 3.50.1 stable nor 3.51.0-0.2.pre beta has it, so an upgrade is not possible yet. - **Red, then green.** The upstream regression test and three variants (`ExcludeSemantics`, `Offstage`, `IndexedStack` instead of `BlockSemantics`) fail on our Flutter 3.50.0 with the null check. On 3.50.0 with only #192724's change applied, all 4 pass. - **No app trigger.** About 1,000 fuzz runs of the real list screen did not crash, on the add sheet, the edit sheet and a hidden tab, at two sizes and two text scales. The app does reach the faulty branch, but the stale cache always pointed at the root, which cannot throw. - **Job 438's lead is ruled out.** The 3.50 deferred-geometry change (368a6dc1) is not the cause, and 3.47 builds were exposed too. ## What changes - `docs/done/453.md` has the evidence, the repro attempts and the check for a Flutter release that has the fix. - `docs/done/438.md` now records #711's merge commit (`630e77a7a`) and points at 453. - `docs/NEEDS_LEAD.md` gets "Job 453": bug 1 stays open until `FLUTTER_VERSION` moves to a stable that has #192724. - `docs/DECISIONS.md` and `DONE_SUMMARY.md` each get a job section. No app code changes, because no app-level trigger is proven. A workaround, such as replacing the add sheet's `ExcludeSemantics`, would be a guess and would change what screen readers get. ## Verification - `scripts/verify.sh --only gitleaks,lint,changelog`: passed. - `git diff origin/main...HEAD -- supabase/functions` is empty. No ARB or legal file is touched, and no hosted service was queried. ## Changelog none 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: Peter Trost <[email protected]>
…docs/done/438.md (#717) Follow-up to #711 (job 438), which fixed PostHog bug 2. This PR is about bug 1: `TypeError: Null check operator used on a null value` in `_RenderObjectSemantics._updateSemanticsNodeGeometry` during `PipelineOwner.flushSemantics`. Docs only. ## What was found - **Cause, upstream.** Bug 1 is [flutter#195316](flutter/flutter#195316). In `flushSemantics`, a node whose geometry turned invisible reads its parent's `firstAncestorNodeWithCleanGeometry` cache without recomputing it. The cache can point at a node whose geometry was cleared in the same flush, and `ensureSemanticsNode()` on that node throws. It needs a branch kept out of the semantics tree (a dialog or sheet barrier, the add sheet's `ExcludeSemantics`, an offstage tab) while the page under it changes. - **Upstream fix.** [flutter#192724](flutter/flutter#192724) merged to Flutter master on 24 Nov 2026. Neither 3.50.1 stable nor 3.51.0-0.2.pre beta has it, so an upgrade is not possible yet. - **Red, then green.** The upstream regression test and three variants (`ExcludeSemantics`, `Offstage`, `IndexedStack` instead of `BlockSemantics`) fail on our Flutter 3.50.0 with the null check. On 3.50.0 with only #192724's change applied, all 4 pass. - **No app trigger.** About 1,000 fuzz runs of the real list screen did not crash, on the add sheet, the edit sheet and a hidden tab, at two sizes and two text scales. The app does reach the faulty branch, but the stale cache always pointed at the root, which cannot throw. - **Job 438's lead is ruled out.** The 3.50 deferred-geometry change (368a6dc1) is not the cause, and 3.47 builds were exposed too. ## What changes - `docs/done/453.md` has the evidence, the repro attempts and the check for a Flutter release that has the fix. - `docs/done/438.md` now records #711's merge commit (`630e77a7a`) and points at 453. - `docs/NEEDS_LEAD.md` gets "Job 453": bug 1 stays open until `FLUTTER_VERSION` moves to a stable that has #192724. - `docs/DECISIONS.md` and `DONE_SUMMARY.md` each get a job section. No app code changes, because no app-level trigger is proven. A workaround, such as replacing the add sheet's `ExcludeSemantics`, would be a guess and would change what screen readers get. ## Verification - `scripts/verify.sh --only gitleaks,lint,changelog`: passed. - `git diff origin/main...HEAD -- supabase/functions` is empty. No ARB or legal file is touched, and no hosted service was queried. ## Changelog none 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: Peter Trost <[email protected]>
…docs/done/438.md (#717) Follow-up to #711 (job 438), which fixed PostHog bug 2. This PR is about bug 1: `TypeError: Null check operator used on a null value` in `_RenderObjectSemantics._updateSemanticsNodeGeometry` during `PipelineOwner.flushSemantics`. Docs only. ## What was found - **Cause, upstream.** Bug 1 is [flutter#195316](flutter/flutter#195316). In `flushSemantics`, a node whose geometry turned invisible reads its parent's `firstAncestorNodeWithCleanGeometry` cache without recomputing it. The cache can point at a node whose geometry was cleared in the same flush, and `ensureSemanticsNode()` on that node throws. It needs a branch kept out of the semantics tree (a dialog or sheet barrier, the add sheet's `ExcludeSemantics`, an offstage tab) while the page under it changes. - **Upstream fix.** [flutter#192724](flutter/flutter#192724) merged to Flutter master on 24 Nov 2026. Neither 3.50.1 stable nor 3.51.0-0.2.pre beta has it, so an upgrade is not possible yet. - **Red, then green.** The upstream regression test and three variants (`ExcludeSemantics`, `Offstage`, `IndexedStack` instead of `BlockSemantics`) fail on our Flutter 3.50.0 with the null check. On 3.50.0 with only #192724's change applied, all 4 pass. - **No app trigger.** About 1,000 fuzz runs of the real list screen did not crash, on the add sheet, the edit sheet and a hidden tab, at two sizes and two text scales. The app does reach the faulty branch, but the stale cache always pointed at the root, which cannot throw. - **Job 438's lead is ruled out.** The 3.50 deferred-geometry change (368a6dc1) is not the cause, and 3.47 builds were exposed too. ## What changes - `docs/done/453.md` has the evidence, the repro attempts and the check for a Flutter release that has the fix. - `docs/done/438.md` now records #711's merge commit (`630e77a7a`) and points at 453. - `docs/NEEDS_LEAD.md` gets "Job 453": bug 1 stays open until `FLUTTER_VERSION` moves to a stable that has #192724. - `docs/DECISIONS.md` and `DONE_SUMMARY.md` each get a job section. No app code changes, because no app-level trigger is proven. A workaround, such as replacing the add sheet's `ExcludeSemantics`, would be a guess and would change what screen readers get. ## Verification - `scripts/verify.sh --only gitleaks,lint,changelog`: passed. - `git diff origin/main...HEAD -- supabase/functions` is empty. No ARB or legal file is touched, and no hosted service was queried. ## Changelog none 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-authored-by: Peter Trost <[email protected]>
Fixes #195316
PipelineOwner.flushSemanticscan crash withNull check operator used on a null valuewhen a semantics boundary becomes invisible while its branch is blocked from the semantics tree (e.g. by theBlockSemanticsof a dialog or modal bottom sheet).Cause
The branch added in #184226 handles a node whose geometry became invisible by adding its parent in the semantics tree to the update targets. When that parent has dirty geometry, it reads
parentInSemanticsTree.firstAncestorNodeWithCleanGeometrydirectly. That cache is only valid for the current flush aftercomputeAncestorInfo(treeShapeToken)has been called on the parent, and nothing guarantees that: thenode._semantics.computeAncestorInfo(treeShapeToken)call just before it stops at the node itself when that node has clean geometry, so it never reaches the parent.So the parent can still hold the value from an earlier flush. If, in between, the ancestor it points to lost its geometry (a semantics boundary that is also a relayout boundary changes, and a non-contributing render object such as a
Transformclears the geometry below it), the stale cache points at a node withgeometry == null. CallingensureSemanticsNode()on it then fails in_buildSemanticsSubtree(geometry!.hidden) or in_produceSemanticsNode->_updateSemanticsNodeGeometry(geometry!).Fix
Call
parentInSemanticsTree.computeAncestorInfo(treeShapeToken)before reading the cache, like the other readers offirstAncestorNodeWithCleanGeometryinflushSemanticsdo. With the token this is a no-op when the value was already computed in this flush.Context
_buildSemanticsSubtreenull check and was closed by fixes crash when invisible semantics nodes dropped from semantics tree #184226, which does not cover this path.owner!inupdateChildren/markNeedsUpdate).Related: #184036 (closed).
Tests
Added a regression test to
test/widgets/semantics_blocked_geometry_test.dart. It uses onlypackage:flutter/widgets.dartand reproduces the stale cache: the page is blocked, a frame caches an ancestor with clean geometry, and the next frame clears that ancestor's geometry while an invisible boundary triggers the lookup._TypeError: Null check operator used on a null valuein_RenderObjectSemantics._buildSemanticsSubtree. With the fix it passes.showModalBottomSheet+ListView+TextField) fails in_updateSemanticsNodeGeometry. Both pass with the fix. That Material repro no longer crashes on master without the fix, so I did not add it.test/rendering/,test/semantics/,test/widgets/*semantics*_test.dart,test/material/bottom_sheet_test.dart,test/material/dialog_test.dart,test/widgets/routes_test.dart,test/widgets/modal_barrier_test.dart. All pass.flutter analyzeanddart formatare clean on the changed files.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.