Skip to content

[Gestures] OneSequenceGestureRecognizer.rejectGesture is a no-op, leaking pointer state and stale arena entries #187475

Description

@ishaq2321

Bug Description

OneSequenceGestureRecognizer.rejectGesture is a no-op ({}). When a recognizer loses the gesture arena, it never calls stopTrackingPointer() or cleans up _entries. This means:

  • Tracked pointers remain routed in the pointer router indefinitely
  • _entries retains stale GestureArenaEntry references
  • Losing team members in GestureArenaTeam scenarios retain per-pointer state forever

This is the root cause behind the TODO in startTrackingPointer:

// TODO(goderbauer): Enable assert after recognizers properly clean up
// their defunct _entries, see https://github.com/flutter/flutter/issues/117356

Steps to Reproduce

  1. Create a GestureArenaTeam with two recognizers
  2. Add a pointer — both recognizers track it
  3. Close the arena — one wins, the other is rejected
  4. The rejected recognizer still has its pointer route active and _entries intact

Expected Behavior

rejectGesture should call stopTrackingPointer and remove the stale _entries entry, with all subclass overrides properly calling through to the base implementation.

Fix

PR: #187515

  • OneSequenceGestureRecognizer.rejectGesture: now calls stopTrackingPointer + removes _entries, marked @mustCallSuper
  • All subclass overrides (PrimaryPointer, Drag, ForcePress, Scale, TapAndDrag) propagate the super.rejectGesture(pointer) call
  • _TapStatusTrackerMixin.rejectGesture now calls super to ensure the chain reaches the base cleanup
  • PrimaryPointerGestureRecognizer.didStopTrackingLastPointer now correctly transitions to ready state and clears initialPosition after rejection

Related: #117356

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: gesturesflutter/packages/flutter/gestures repository.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions