From 86d0aaa021f146529a65228de9e07d5f4df5b099 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Sat, 19 Jun 2021 13:57:45 -0300 Subject: [PATCH] fix(core): notification panic on Windows, closes #917 (#2011) --- .changes/fix-notifications-on-windows.md | 5 +++++ core/tauri/src/api/notification.rs | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changes/fix-notifications-on-windows.md diff --git a/.changes/fix-notifications-on-windows.md b/.changes/fix-notifications-on-windows.md new file mode 100644 index 000000000..3d875648d --- /dev/null +++ b/.changes/fix-notifications-on-windows.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Run the `notification.show()` method on a dedicated async task to prevent a panic on Windows. diff --git a/core/tauri/src/api/notification.rs b/core/tauri/src/api/notification.rs index ca9935520..2df6201c1 100644 --- a/core/tauri/src/api/notification.rs +++ b/core/tauri/src/api/notification.rs @@ -81,7 +81,11 @@ impl Notification { notification.app_id(&self.identifier); } } - notification.show()?; + + crate::async_runtime::spawn(async move { + notification.show().expect("failed to show notification"); + }); + Ok(()) } }