Skip to content

[Windows]Application Crash on Process Exit When Using flutter_inappwebview Plugin on Windows #2733

@li986726488-dotcom

Description

@li986726488-dotcom

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Description:
The Flutter application crashes during process termination on the Windows platform when the flutter_inappwebview plugin (version 6.1.5) is integrated. The crash occurs consistently when closing the application through any method (taskbar close button, window close button, or system shutdown).

Steps to Reproduce:

  1. Create a new Flutter example project
  2. Add flutter_inappwebview: ^6.1.5 dependency in pubspec.yaml
  3. Build the Windows executable: flutter build windows
  4. Run the generated executable on Windows
  5. Close the application using any method (taskbar, window close button, etc.)
  6. Observe the application crash during process termination

Expected Behavior:
The application should exit cleanly without crashes when closed normally.

Actual Behavior:
The application crashes with an access violation during process shutdown. The crash occurs in the flutter_inappwebview_windows_plugin.dll during the cleanup of WinRT Composition objects.

Crash Details:

Crash Location: winrt::com_ptrABI::Windows::UI::Composition::ICompositor::unconditional_release_ref()

Trigger: DLL process detachment (DLL_PROCESS_DETACH)

Root Cause: Static object destruction order issue - WinRT components (CoreMessaging.dll, dcomp.dll) are unloaded before the plugin's static compositor_ object is destroyed

Image

Expected Behavior

The application should exit cleanly without crashes when closed normally.

Steps with code example to reproduce

Steps with code example to reproduce
// Paste your code here

Stacktrace/Logs

Stacktrace/Logs
<Replace this line by pasting your stacktrace or logs here>

Flutter version

v3.35.7

Operating System, Device-specific and/or Tool

windows11

Plugin version

v6.1.5

Additional information

No response

Self grab

  • I'm ready to work on this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions