diff --git a/crates/ui-egui/src/app/framework.rs b/crates/ui-egui/src/app/framework.rs index ea8e63a4868..5d5e738a40f 100644 --- a/crates/ui-egui/src/app/framework.rs +++ b/crates/ui-egui/src/app/framework.rs @@ -74,10 +74,11 @@ pub(crate) fn install(ctx: &egui::Context, fonts: &UiFonts<'_>, frame: Option = if frame.is_some() { Arc::new(Desktop) } else { Arc::new(NoWindows) }; - let mut spec = InstallSpec::new(ShellInfo::default().backend(Backend::from_env()), desktop) - .wheel(wheel) - .app_id(crate::os_window::app_id()) - .system(SystemReader::start(move || wake.request_repaint())); + // The same goes for the OS's appearance: a headless context starts no desktop watcher. Each watcher has a worker + // thread, and a test binary that runs every test in one process (plain `cargo test` on FreeBSD and Windows) would + // otherwise keep one per context until it can spawn no more threads. + let system = if frame.is_some() { SystemReader::start(move || wake.request_repaint()) } else { SystemReader::unwatched() }; + let mut spec = InstallSpec::new(ShellInfo::default().backend(Backend::from_env()), desktop).wheel(wheel).app_id(crate::os_window::app_id()).system(system); if let Some(decision) = frame { spec = spec.frame(decision); }