Skip to content

fix: Prevent drag updates from reaching removed components#3901

Merged
spydon merged 4 commits intoflame-engine:mainfrom
MikeChen1109:mikechen1109.joystick-drag-removal-crash
Apr 14, 2026
Merged

fix: Prevent drag updates from reaching removed components#3901
spydon merged 4 commits intoflame-engine:mainfrom
MikeChen1109:mikechen1109.joystick-drag-removal-crash

Conversation

@MikeChen1109
Copy link
Copy Markdown
Contributor

@MikeChen1109 MikeChen1109 commented Apr 13, 2026

Description

Fixes a crash caused by MultiDragDispatcher continuing to send drag updates to components that were removed during an active drag.

Removed drag targets are now cancelled and cleaned up instead of receiving further updates. This also keeps drag state consistent for DragCallbacks.

Added regression tests for:

  • joystick removal during active drag
  • dragged component state cleanup after removal

Checklist

  • I have followed the [Contributor Guide] when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Fixes #3897

@MikeChen1109 MikeChen1109 marked this pull request as ready for review April 13, 2026 15:28
@MikeChen1109 MikeChen1109 marked this pull request as draft April 13, 2026 15:29
@MikeChen1109 MikeChen1109 marked this pull request as ready for review April 13, 2026 15:34
Copy link
Copy Markdown
Member

@spydon spydon left a comment

Choose a reason for hiding this comment

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

Lgtm, thanks for your contribution!

@spydon spydon merged commit 3d58c9a into flame-engine:main Apr 14, 2026
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Joystick crash when component is removed during active drag (DisplacementEvent.localEndPosition -> List.last)

2 participants