From 1518c223f636c674740bb0a2b6237856c7608576 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Thu, 4 Jan 2024 16:38:49 -0800 Subject: [PATCH] Don't drop tokio runtime immediately --- packages/desktop/src/lib.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/desktop/src/lib.rs b/packages/desktop/src/lib.rs index 1fc3e99c0..96c763045 100644 --- a/packages/desktop/src/lib.rs +++ b/packages/desktop/src/lib.rs @@ -113,11 +113,8 @@ pub fn launch_with_props(root: Component

, props: P, cfg: Config) // We start the tokio runtime *on this thread* // Any future we poll later will use this runtime to spawn tasks and for IO // I would love to just allow dioxus to work with any runtime... but tokio is weird - let _guard = Builder::new_multi_thread() - .enable_all() - .build() - .unwrap() - .enter(); + let rt = &Builder::new_multi_thread().enable_all().build().unwrap(); + let _guard = rt.enter(); let (event_loop, mut app) = app::App::new(cfg, props, root);