Skip to content

Fix multi-window pointer event crash #146251

@loic-sharma

Description

@loic-sharma

Repro steps

Launch a Flutter Windows app with multiple windows. Overlap the windows and move your pointer back and forth between the two windows. This will eventually crash.

This is known to affect Windows but might affect macOS and Linux too.

Root cause

Pointer events have a "device ID" that must be globally unique, or an assertion will crash the app.

Flutter Windows reuses the same "device ID" if a mouse is moved from one view to another. Usually, Windows generates a "remove pointer" event from the source view and an "add pointer" event to the destination view. However, sometimes the "remove pointer" event isn't generated when the mouse exits a view; this crashes the app on the "pointer add" event.

Possible causes:

  1. win32 sometimes sends "remove" and "add" pointer events out-of-order
  2. win32 sometimes reports that a mouse is on multiple HWNDs at once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: multi windowIssues related to multi window supportengineflutter/engine related. See also e: labels.platform-windowsBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions