Merge pull request #10070 from yahya-nusseibeh/fix/launcher-no-remove-var

Launcher: open HORIZON_LAUNCHER_PROJECT once without remove_var
This commit is contained in:
Kacper authored and GitHub committed 2026-11-06 09:10:29 +01:00
commit 1a57f3660d
1 file changed
+9 -3
+9 -3
View File
@@ -416,8 +416,14 @@ impl Launcher {
}
}
// `HORIZON_LAUNCHER_PROJECT=<slug>` (with `HORIZON_LAUNCHER_PAGE=mods`): opens that
// project's page once a search finds it, for screenshots.
if self.mods.browse.open.is_none() {
// project's page once a search finds it, for screenshots. Once per run, kept in a flag
// rather than by removing the variable: `remove_var` races `getenv` on the download, check
// and keyring threads running by now (unsound, and `unsafe` from edition 2024).
static PROJECT_OPENED: std::sync::atomic::AtomicBool =
std::sync::atomic::AtomicBool::new(false);
if self.mods.browse.open.is_none()
&& !PROJECT_OPENED.load(std::sync::atomic::Ordering::Relaxed)
{
if let Ok(want) = std::env::var("HORIZON_LAUNCHER_PROJECT") {
if let Some(p) = self
.mods
@@ -426,7 +432,7 @@ impl Launcher {
.find(|p| p.id == want || p.slug == want)
.cloned()
{
std::env::remove_var("HORIZON_LAUNCHER_PROJECT");
PROJECT_OPENED.store(true, std::sync::atomic::Ordering::Relaxed);
self.mods_open(p);
}
}