Skip to content

[Windows] Alt+F4 may crash the engine when using multiple windows on Windows #158450

@hbatagelo

Description

@hbatagelo

Steps to reproduce:

  1. Launch a Flutter multi-window app on Windows (e.g., a sample from the "MVP - The Multi View Playground", or the reference app from [windows] implement regular windows and supporting method channels #157515).
  2. Open a new window.
  3. Press Alt+F4 to close it.
  4. The engine may crash.

Possible cause:

When a key is pressed, FlutterWindowsView::SendKey sends the raw keyboard event to the engine along with a lambda expression as a KeyEventCallback for processing the queued events. Because Alt+F4 immediately closes the window, the view may be destroyed before the callback is invoked. The engine crashes when the callback tries to access already-destroyed objects, such as the FlutterWindowsView itself (its this pointer is captured by the lambda to access FlutterWindowsView::engine_) and the KeyboardManager object, which is owned by the FlutterWindow destroyed with the view.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: desktopRunning on desktopa: multi windowIssues related to multi window supportc: crashStack traces logged to the consoleengineflutter/engine related. See also e: labels.platform-windowsBuilding on or for Windows specificallyr: fixedIssue is closed as already fixed in a newer versionteam-windowsOwned by the Windows platform team

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions