mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-27 16:51:15 -03:00
Make commandline state thread safe
Today the reader exposes its internals directly, e.g. to the commandline builtin. This is of course not thread safe. For example in concurrent execution, running `commandline` twice in separate threads would cause a race and likely a crash. Fix this by factoring all the commandline state into a new type 'commandline_state_t'. Make it a singleton (there is only one command line after all) and protect it with a lock. No user visible change here.
This commit is contained in:
@@ -729,7 +729,7 @@ maybe_t<env_var_t> env_scoped_impl_t::try_get_computed(const wcstring &key) cons
|
||||
return none();
|
||||
}
|
||||
|
||||
std::shared_ptr<history_t> history = reader_get_history();
|
||||
std::shared_ptr<history_t> history = commandline_get_state().history;
|
||||
if (!history) {
|
||||
history = history_t::with_name(history_session_id(*this));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user