diff --git a/.changes/fix-async-runtime-stack-overflow.md b/.changes/fix-async-runtime-stack-overflow.md new file mode 100644 index 000000000..d5017cbfe --- /dev/null +++ b/.changes/fix-async-runtime-stack-overflow.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Fix stack overflow on Windows on commands by changing the implementation of the `async_runtime::spawn` method. diff --git a/core/tauri/src/async_runtime.rs b/core/tauri/src/async_runtime.rs index 052193682..15937ef28 100644 --- a/core/tauri/src/async_runtime.rs +++ b/core/tauri/src/async_runtime.rs @@ -103,7 +103,10 @@ impl Runtime { F::Output: Send + 'static, { match self { - Self::Tokio(r) => JoinHandle::Tokio(r.spawn(task)), + Self::Tokio(r) => { + let _guard = r.enter(); + JoinHandle::Tokio(tokio::spawn(task)) + } } } @@ -193,7 +196,10 @@ impl RuntimeHandle { F::Output: Send + 'static, { match self { - Self::Tokio(h) => JoinHandle::Tokio(h.spawn(task)), + Self::Tokio(h) => { + let _guard = h.enter(); + JoinHandle::Tokio(tokio::spawn(task)) + } } }