Skip to content

[web] Fix potential race condition in ClickDebouncer - #173294

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
mdebbar:debounce_race_condition
Aug 5, 2025
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
mdebbar:debounce_race_condition

Conversation

@mdebbar

@mdebbar mdebbar commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

Based on Gemini's comment: #173072 (comment)

@mdebbar
mdebbar requested a review from justinmc August 5, 2025 17:48
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Aug 5, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a potential race condition in the ClickDebouncer. The fix is straightforward and correct: it adds a check to ensure that debouncing has not been cancelled before proceeding with setting the debouncer state. The newly added test case is comprehensive and accurately simulates the race condition, confirming the effectiveness of the fix. The changes are well-implemented and improve the robustness of the pointer event handling.

@justinmc justinmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍

///
/// This method is called asynchronously from [_maybeStartDebouncing].
void _doStartDebouncing(DomEvent event, List<ui.PointerData> data) {
// It's possible that debouncing was cancelled between the pointerdown event and the execution

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2025
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 5, 2025
Merged via the queue into flutter:master with commit 59fc766 Aug 5, 2025
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2025
danilozhang pushed a commit to danilozhang/flutter that referenced this pull request Aug 6, 2025
@mdebbar
mdebbar deleted the debounce_race_condition branch August 6, 2025 16:16
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants