mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-09-11 16:08:21 +03:00
fix(core): deadlock on window create (#9429)
* fix(core): deadlock on window create * Update mod.rs Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de> --------- Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
This commit is contained in:
parent
4973d73a23
commit
32b213399f
@ -424,17 +424,22 @@ tauri::Builder::default()
|
|||||||
crate::vibrancy::set_window_effects(&window, Some(effects))?;
|
crate::vibrancy::set_window_effects(&window, Some(effects))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
app_manager.webview.eval_script_all(format!(
|
let app_manager = self.manager.manager_owned();
|
||||||
"window.__TAURI_INTERNALS__.metadata.windows = {window_labels_array}.map(function (label) {{ return {{ label: label }} }})",
|
let window_label = window.label().to_string();
|
||||||
window_labels_array = serde_json::to_string(&app_manager.window.labels())?,
|
// run on the main thread to fix a deadlock on webview.eval if the tracing feature is enabled
|
||||||
))?;
|
let _ = window.run_on_main_thread(move || {
|
||||||
|
let _ = app_manager.webview.eval_script_all(format!(
|
||||||
|
"window.__TAURI_INTERNALS__.metadata.windows = {window_labels_array}.map(function (label) {{ return {{ label: label }} }})",
|
||||||
|
window_labels_array = serde_json::to_string(&app_manager.window.labels()).unwrap(),
|
||||||
|
));
|
||||||
|
|
||||||
app_manager.emit(
|
let _ = app_manager.emit(
|
||||||
"tauri://window-created",
|
"tauri://window-created",
|
||||||
Some(crate::webview::CreatedEvent {
|
Some(crate::webview::CreatedEvent {
|
||||||
label: window.label().into(),
|
label: window_label,
|
||||||
}),
|
}),
|
||||||
)?;
|
);
|
||||||
|
});
|
||||||
|
|
||||||
Ok(window)
|
Ok(window)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user