mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-21 19:41:14 -03:00
Track histories with shared_ptr
Prior to this change, histories were immortal and allocated with either unique_ptr or just leaked via new. But this can result in races in the path detection test, as the destructor races with the pointer-captured history. Switch to using shared_ptr.
This commit is contained in:
@@ -687,9 +687,9 @@ maybe_t<env_var_t> env_scoped_impl_t::try_get_computed(const wcstring &key) cons
|
||||
return none();
|
||||
}
|
||||
|
||||
history_t *history = reader_get_history();
|
||||
std::shared_ptr<history_t> history = reader_get_history();
|
||||
if (!history) {
|
||||
history = &history_t::history_with_name(history_session_id(*this));
|
||||
history = history_t::with_name(history_session_id(*this));
|
||||
}
|
||||
wcstring_list_t result;
|
||||
if (history) history->get_history(result);
|
||||
|
||||
Reference in New Issue
Block a user