mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 02:16:31 +00:00
TUI/thread: guard env map from potential race with unibilium #11259
unibi_from_term calls getenv internally, so exclusive control is required.
This commit is contained in:
@@ -44,6 +44,16 @@ void env_init(void)
|
||||
uv_mutex_init(&mutex);
|
||||
}
|
||||
|
||||
void os_env_var_lock(void)
|
||||
{
|
||||
uv_mutex_lock(&mutex);
|
||||
}
|
||||
|
||||
void os_env_var_unlock(void)
|
||||
{
|
||||
uv_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
/// Like getenv(), but returns NULL if the variable is empty.
|
||||
/// @see os_env_exists
|
||||
const char *os_getenv(const char *name)
|
||||
|
@@ -234,7 +234,9 @@ static void terminfo_start(UI *ui)
|
||||
// Set up unibilium/terminfo.
|
||||
char *termname = NULL;
|
||||
if (term) {
|
||||
os_env_var_lock();
|
||||
data->ut = unibi_from_term(term);
|
||||
os_env_var_unlock();
|
||||
if (data->ut) {
|
||||
termname = xstrdup(term);
|
||||
}
|
||||
|
Reference in New Issue
Block a user