Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changes/fix-arm64-cowait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"wry": patch
---

Fix ARM64 WebView2 deadlock by replacing nested message pump with CoWaitForMultipleHandles.

On Windows ARM64 (e.g. Snapdragon X Elite), creating a second WebView2 controller from the
main STA thread would deadlock in MsgWaitForMultipleObjectsEx because the nested
GetMessage/PeekMessage loop prevented COM from re-entering the apartment to deliver the
async completion callback.

This patch replaces the mpsc::channel + wait_with_pump pattern in create_environment(),
create_controller(), and cookies_inner() with CoWaitForMultipleHandles using
COWAIT_DISPATCH_CALLS | COWAIT_DISPATCH_WINDOW_MESSAGES, which is the COM-sanctioned
mechanism for yielding an STA thread while preserving re-entrancy.

Ref: https://github.com/npiesco/wry-arm64-deadlock (minimal reproduction)
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ features = [
"Win32_System_Ole",
"Win32_System_SystemInformation",
"Win32_System_SystemServices",
"Win32_System_Threading",
"Win32_Security",
"Win32_UI_Shell",
"Win32_UI_WindowsAndMessaging",
"Win32_Globalization",
Expand Down
Loading