Fix stale eagerWinner reference in GestureArenaManager when rejected before arena close#187008
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the GestureArenaManager in arena.dart to clear the eagerWinner reference if that member is rejected while the arena remains open. This change prevents potential issues where a stale eager winner could be incorrectly accepted after rejection. Additionally, a new test case in arena_test.dart verifies that the eager winner is correctly cleared and that subsequent arena resolution via sweep functions as expected. I have no feedback to provide.
08cc142 to
400b8cc
Compare
Piinks
left a comment
There was a problem hiding this comment.
Hey @ishaq2321 thanks for contributing! Regarding "Fixes two related architectural issues in the gesture arena system:", can you please open issues for each of these in the repository? It's also best to have 1 PR fix 1 issue. Thanks!
d756b46 to
ecae7a8
Compare
|
Hey @Piinks, thanks for the review. Opened two issues as requested:
PR description updated to link both. All 345 gesture tests still green. Let me know if anything else is needed. |
Piinks
left a comment
There was a problem hiding this comment.
Thanks for filing issues for these!
It's also best to have 1 PR fix 1 issue.
This is still relevant here. This should be split into two PRs, one for each issue. Thanks!
ecae7a8 to
89da8f5
Compare
89da8f5 to
c16cee1
Compare
c16cee1 to
9b804ef
Compare
|
Thank you for the approval on this PR! I noticed it hasn't been merged yet, and I was wondering if we could move forward with the final steps. I am currently at my limit of 4 open PRs, which is preventing me from opening new ones. If there is anything else needed from my side to get this across the finish line, please let me know—I am happy to help. Otherwise, I would appreciate it if this could be merged so I can continue with my next contribution. Thanks again! |
9b804ef to
f3d7f00
Compare
|
It looks like we still need a second approval here, it's almost ready to merge thanks for your patience and contributions! |
|
It looks like this is not targeting the right branch, can you update to target master, not main? |
|
Done — updated to target master. Thanks for the heads up @Piinks! |
f3d7f00 to
b9774c0
Compare
|
@Piinks rebased onto latest master and target branch fixed. This was previously approved (LGTM) — the approval was reset when we changed the base from main to master. Ready for re-review when you get a chance. Thanks! |
Renzo-Olivares
left a comment
There was a problem hiding this comment.
LGTM, thank you for the contribution!
|
@ishaq2321 the linux analyzer issues need to be resolved before landing this. |
…before arena close
When a GestureArenaMember calls resolve(GestureDisposition.accepted)
while the arena is still open, it becomes the eagerWinner via
state.eagerWinner ??= member. If that same member subsequently calls
resolve(GestureDisposition.rejected) while the arena remains open,
the _resolve method removes the member from state.members but never
clears state.eagerWinner. This leaves a dangling pointer to an
already-rejected-and-removed member.
When the arena later closes, _tryToResolveArena checks
state.eagerWinner != null and delegates to _resolveInFavorOf with
the stale member. This causes:
- The stale member to receive acceptGesture despite having already
been rejected (assertion failure in debug mode via
_CombiningGestureArenaMember._close)
- All remaining legitimate members to be incorrectly rejected
Fix: Clear state.eagerWinner in the rejected case when the rejected
member matches the current eagerWinner.
Co-authored-by: Muhammad Ishaq Khan <[email protected]>
…ations and unused variables
b9774c0 to
3a7bb14
Compare
|
autosubmit label was removed for flutter/flutter/187008, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
The Google tests failed. They don't usually flake but it looked like an infra flake to me, so I reran them. |
flutter/flutter@846664b...fc1ad95 2026-07-15 [email protected] [iOS] Migrate FlutterKeyboardInsetManager to Swift (flutter/flutter#189425) 2026-07-15 [email protected] Roll Dart SDK from 05bf153370c4 to 0c408ff6dce9 (4 revisions) (flutter/flutter#189487) 2026-07-15 [email protected] Implement UberSDF lines to replace LineContents-based AA lines (flutter/flutter#188514) 2026-07-15 [email protected] Fix stale eagerWinner reference in GestureArenaManager when rejected before arena close (flutter/flutter#187008) 2026-07-15 [email protected] Disable some Windows tests that are flaking on CI (flutter/flutter#189477) 2026-07-15 dmgr Added unified check-run user manual (flutter/flutter#189453) 2026-07-15 [email protected] Roll Skia from 88954ef8f36d to ab2410bc857c (9 revisions) (flutter/flutter#189474) 2026-07-14 [email protected] [agents] Refactor shepherd-prs skill into a pure Markdown runbook using native gh CLI (flutter/flutter#189095) 2026-07-14 [email protected] Add missing name to mirroring workflow (flutter/flutter#189439) 2026-07-14 [email protected] Add support for WASM deferred loading. (flutter/flutter#189308) 2026-07-14 [email protected] fix `templateDefaultGradleVersion` todo (flutter/flutter#189466) 2026-07-14 [email protected] Roll Fuchsia Linux SDK from oOETA0ISPouDt2xBo... to lLFbh5kFWbUGgC9Ek... (flutter/flutter#189469) 2026-07-14 [email protected] Use ServicesBinding.instance.exitApplication instead of exit(0) in multiple_windows example (flutter/flutter#189364) 2026-07-14 [email protected] Add CpuArch to the Device class (flutter/flutter#189207) 2026-07-14 [email protected] Fix space formatting in cherry-pick label for flutter_cp.dart (flutter/flutter#189463) 2026-07-14 [email protected] Roll pub packages (flutter/flutter#189454) 2026-07-14 [email protected] [flutter_tools] Format plugin example template to match dart format (flutter/flutter#188382) 2026-07-14 [email protected] Move renamed x64->ARM benchmarks out of bringup (flutter/flutter#189400) 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],[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
Summary
Fixes a stale
eagerWinnerreference inGestureArenaManager. When a member accepts while the arena is open (becomingeagerWinner) and then rejects while still open,eagerWinnerretained a dangling reference to the now-rejected member. When the arena later closed, it resolved in favor of the stale member, incorrectly rejecting all legitimate remaining members.Fixes #187474
Changes
state.eagerWinnerwhen the rejected member matches the current eager winner in_resolve()Eager winner should be cleared when the eager winner rejects while arena is still openinarena_test.dartTests
All 345 gesture tests pass.