config: defer evaluating default wsl domains
The stack trace in https://github.com/wez/wezterm/issues/3425
shows a recursive borrow triggered indirectly by spawning
a subprocess and having that trigger the wndproc.
This commit doesn't really fix the recursive problem, but may
sidestep it, and it's probably best to avoid always running
the `wsl` command to get this list anyway, similar to the
change in 25255d90d6
refs: https://github.com/wez/wezterm/issues/3425
This commit is contained in:
3 files changed
+16
-6
No files matched your search
+14
-4
@@ -312,8 +312,8 @@ pub struct Config {
|
||||
#[dynamic(default)]
|
||||
pub webgpu_preferred_adapter: Option<GpuInfo>,
|
||||
|
||||
#[dynamic(default = "WslDomain::default_domains")]
|
||||
pub wsl_domains: Vec<WslDomain>,
|
||||
#[dynamic(default)]
|
||||
pub wsl_domains: Option<Vec<WslDomain>>,
|
||||
|
||||
#[dynamic(default)]
|
||||
pub exec_domains: Vec<ExecDomain>,
|
||||
@@ -839,6 +839,14 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wsl_domains(&self) -> Vec<WslDomain> {
|
||||
if let Some(domains) = &self.wsl_domains {
|
||||
domains.clone()
|
||||
} else {
|
||||
WslDomain::default_domains()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_ulimit(&self) -> anyhow::Result<()> {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
@@ -1146,8 +1154,10 @@ impl Config {
|
||||
for d in &self.exec_domains {
|
||||
check_domain(&d.name, "exec domain")?;
|
||||
}
|
||||
for d in &self.wsl_domains {
|
||||
check_domain(&d.name, "wsl domain")?;
|
||||
if let Some(domains) = &self.wsl_domains {
|
||||
for d in domains {
|
||||
check_domain(&d.name, "wsl domain")?;
|
||||
}
|
||||
}
|
||||
for d in &self.tls_clients {
|
||||
check_domain(&d.name, "tls domain")?;
|
||||
|
||||
+1
-1
@@ -207,7 +207,7 @@ impl LocalDomain {
|
||||
|
||||
fn resolve_wsl_domain(&self) -> Option<WslDomain> {
|
||||
config::configuration()
|
||||
.wsl_domains
|
||||
.wsl_domains()
|
||||
.iter()
|
||||
.find(|d| d.name == self.name)
|
||||
.cloned()
|
||||
|
||||
@@ -373,7 +373,7 @@ fn update_mux_domains(config: &ConfigHandle) -> anyhow::Result<()> {
|
||||
mux.add_domain(&domain);
|
||||
}
|
||||
|
||||
for wsl_dom in &config.wsl_domains {
|
||||
for wsl_dom in config.wsl_domains() {
|
||||
if mux.get_domain_by_name(&wsl_dom.name).is_some() {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user