fix(core): deadlock on focus events with invisible window,#3534 (#3622)

Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
This commit is contained in:
Lucas Fernandes Nogueira
2022-03-06 18:44:12 -03:00
committed by GitHub
parent 3f45c23a75
commit c08cc6d500
2 changed files with 11 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"tauri-runtime-wry": patch
---
Fixes a deadlock on the `Focused` event when the window is not visible.

View File

@@ -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();
}
}
}