mirror of
https://github.com/tauri-apps/tauri.git
synced 2025-01-04 09:08:38 +03:00
fix(linux): use glib main context for the updater on linux (#2222)
This commit is contained in:
parent
f0a8db62e4
commit
3389bd8180
5
.changes/tauri-updater-linux.md
Normal file
5
.changes/tauri-updater-linux.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Use glib context for linux updater to prevent GTK panic.
|
@ -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]
|
[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" ] }
|
gtk = { version = "0.9", features = [ "v3_16" ] }
|
||||||
|
glib = "0.10"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cfg_aliases = "0.1.1"
|
cfg_aliases = "0.1.1"
|
||||||
|
@ -369,9 +369,19 @@ impl<R: Runtime> App<R> {
|
|||||||
fn run_updater_dialog(&self, window: Window<R>) {
|
fn run_updater_dialog(&self, window: Window<R>) {
|
||||||
let updater_config = self.manager.config().tauri.updater.clone();
|
let updater_config = self.manager.config().tauri.updater.clone();
|
||||||
let package_info = self.manager.package_info().clone();
|
let package_info = self.manager.package_info().clone();
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "linux"))]
|
||||||
crate::async_runtime::spawn(async move {
|
crate::async_runtime::spawn(async move {
|
||||||
updater::check_update_with_dialog(updater_config, package_info, window).await
|
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.
|
/// Listen updater events when dialog are disabled.
|
||||||
@ -807,9 +817,6 @@ impl<R: Runtime> Builder<R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "updater")]
|
|
||||||
app.run_updater(main_window);
|
|
||||||
|
|
||||||
(self.setup)(&mut app).map_err(|e| crate::Error::Setup(e))?;
|
(self.setup)(&mut app).map_err(|e| crate::Error::Setup(e))?;
|
||||||
|
|
||||||
#[cfg(feature = "system-tray")]
|
#[cfg(feature = "system-tray")]
|
||||||
@ -882,6 +889,9 @@ impl<R: Runtime> Builder<R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "updater")]
|
||||||
|
app.run_updater(main_window);
|
||||||
|
|
||||||
Ok(app)
|
Ok(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user