mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-25 19:54:07 +03:00
fix(core): deadlock on window event handler
This commit is contained in:
parent
63ae30f187
commit
4866404f04
@ -2024,22 +2024,29 @@ fn handle_user_message(
|
||||
}
|
||||
}
|
||||
}
|
||||
Message::Webview(id, webview_message) => {
|
||||
Message::Webview(id, webview_message) => match webview_message {
|
||||
WebviewMessage::EvaluateScript(script) => {
|
||||
if let Some(WindowHandle::Webview(webview)) = windows
|
||||
.lock()
|
||||
.expect("poisoned webview collection")
|
||||
.get(&id)
|
||||
.map(|w| &w.inner)
|
||||
{
|
||||
match webview_message {
|
||||
WebviewMessage::EvaluateScript(script) => {
|
||||
if let Err(e) = webview.evaluate_script(&script) {
|
||||
eprintln!("{}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
WebviewMessage::Print => {
|
||||
if let Some(WindowHandle::Webview(webview)) = windows
|
||||
.lock()
|
||||
.expect("poisoned webview collection")
|
||||
.get(&id)
|
||||
.map(|w| &w.inner)
|
||||
{
|
||||
let _ = webview.print();
|
||||
}
|
||||
}
|
||||
WebviewMessage::WebviewEvent(event) => {
|
||||
if let Some(event) = WindowEventWrapper::from(&event).0 {
|
||||
for handler in window_event_listeners
|
||||
@ -2055,9 +2062,7 @@ fn handle_user_message(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Message::CreateWebview(handler, sender) => {
|
||||
if let Some(event_loop) = event_loop {
|
||||
match handler(event_loop, web_context) {
|
||||
|
Loading…
Reference in New Issue
Block a user