Преглед на файлове

fix(core): notification panic on Windows, closes #917 (#2011)

Lucas Fernandes Nogueira преди 4 години
родител
ревизия
86d0aaa021
променени са 2 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 5 0
      .changes/fix-notifications-on-windows.md
  2. 5 1
      core/tauri/src/api/notification.rs

+ 5 - 0
.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.

+ 5 - 1
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(())
   }
 }