Skip to content

Commit 638804e

Browse files
fix: ensure set_window_effects runs on main thread in WindowBuilder (#13422) (#13423)
Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
1 parent 1686296 commit 638804e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": "patch:bug"
3+
---
4+
5+
Fixed set_window_effects not runs on main thread in WindowBuilder.

crates/tauri/src/window/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,14 @@ tauri::Builder::default()
406406
window.on_menu_event(handler);
407407
}
408408

409-
if let Some(effects) = self.window_effects {
410-
crate::vibrancy::set_window_effects(&window, Some(effects))?;
411-
}
412-
413409
let app_manager = self.manager.manager_owned();
414410
let window_label = window.label().to_string();
411+
let window_ = window.clone();
415412
// run on the main thread to fix a deadlock on webview.eval if the tracing feature is enabled
416413
let _ = window.run_on_main_thread(move || {
414+
if let Some(effects) = self.window_effects {
415+
_ = crate::vibrancy::set_window_effects(&window_, Some(effects));
416+
}
417417
let event = crate::EventName::from_str("tauri://window-created");
418418
let payload = Some(crate::webview::CreatedEvent {
419419
label: window_label,

0 commit comments

Comments
 (0)