diff --git a/.changes/tauri-updater-linux.md b/.changes/tauri-updater-linux.md new file mode 100644 index 000000000..2414249e2 --- /dev/null +++ b/.changes/tauri-updater-linux.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Use glib context for linux updater to prevent GTK panic. diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 6526ce462..820832fed 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -71,6 +71,7 @@ minisign-verify = { version = "0.1", optional = true } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] gtk = { version = "0.9", features = [ "v3_16" ] } +glib = "0.10" [build-dependencies] cfg_aliases = "0.1.1" diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index b25bd2755..d2828b4b1 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -369,9 +369,19 @@ impl App { fn run_updater_dialog(&self, window: Window) { let updater_config = self.manager.config().tauri.updater.clone(); let package_info = self.manager.package_info().clone(); + + #[cfg(not(target_os = "linux"))] crate::async_runtime::spawn(async move { updater::check_update_with_dialog(updater_config, package_info, window).await }); + + #[cfg(target_os = "linux")] + { + let context = glib::MainContext::default(); + context.spawn_with_priority(glib::PRIORITY_HIGH, async move { + updater::check_update_with_dialog(updater_config, package_info, window).await + }); + } } /// Listen updater events when dialog are disabled. @@ -807,9 +817,6 @@ impl Builder { } } - #[cfg(feature = "updater")] - app.run_updater(main_window); - (self.setup)(&mut app).map_err(|e| crate::Error::Setup(e))?; #[cfg(feature = "system-tray")] @@ -882,6 +889,9 @@ impl Builder { } } + #[cfg(feature = "updater")] + app.run_updater(main_window); + Ok(app) }