diff --git a/.changes/fix-window-creation-deadlock.md b/.changes/fix-window-creation-deadlock.md new file mode 100644 index 000000000..9f88bcc97 --- /dev/null +++ b/.changes/fix-window-creation-deadlock.md @@ -0,0 +1,5 @@ +--- +"tauri-runtime-wry": patch +--- + +Fixes a deadlock on the `Focused` event when the window is not visible. diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 037afaf30..1a5d882e9 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -2373,7 +2373,12 @@ fn handle_event_loop( .get(&window_id) .map(|w| &w.inner) { - webview.focus(); + // only focus the webview if the window is visible + // somehow tao is sending a Focused(true) event even when the window is invisible, + // which causes a deadlock: https://github.com/tauri-apps/tauri/issues/3534 + if webview.window().is_visible() { + webview.focus(); + } } }