Revert "Add vector of cleanup/termination events to be executed before quit"

This reverts commit 8c14f0f30f.

This list is not reliable - there are many ways for fish to quit that does not
invoke these functions. It's also not necessary since the history is correctly
saved on exec.
This commit is contained in:
ridiculousfish 2018-09-28 20:21:23 -04:00
parent a389ca694c
commit a17a815c87
4 changed files with 0 additions and 16 deletions

View file

@ -78,7 +78,6 @@ static void debug_shared(const wchar_t msg_level, const wcstring &msg);
const wcstring whitespace = L" \t\r\n\v";
const char *whitespace_narrow = " \t\r\n\v";
std::stack<std::function<void()>> before_exit;
bool is_whitespace(const wchar_t input) {
for (auto c : whitespace) {

View file

@ -21,7 +21,6 @@
#include <memory>
#include <mutex>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
@ -424,8 +423,6 @@ void assert_is_background_thread(const char *who);
#define ASSERT_IS_BACKGROUND_THREAD_TRAMPOLINE(x) assert_is_background_thread(x)
#define ASSERT_IS_BACKGROUND_THREAD() ASSERT_IS_BACKGROUND_THREAD_TRAMPOLINE(__FUNCTION__)
extern std::stack<std::function<void()>> before_exit;
// fish_mutex is a wrapper around std::mutex that tracks whether it is locked, allowing for checking
// if the mutex is locked. It owns a boolean guarded by the lock that records whether the lock is
// currently locked; this is only used by assertions for correctness.

View file

@ -359,12 +359,6 @@ static bool can_use_posix_spawn_for_job(const job_t *job, const process_t *proce
void internal_exec(job_t *j, const io_chain_t &&all_ios) {
// Do a regular launch - but without forking first...
// since we are about to quit, make sure to run pending cleanup tasks
while (!before_exit.empty()) {
before_exit.top()();
before_exit.pop();
}
// setup_child_process makes sure signals are properly set up.
// PCA This is for handling exec. Passing all_ios here matches what fish 2.0.0 and 1.x did.

View file

@ -466,12 +466,6 @@ int main(int argc, char **argv) {
parser.emit_profiling(s_profiling_output_filename);
}
// since we exit without destructors, we need some way to run cleanup code when necessary
while (!before_exit.empty()) {
before_exit.top()();
before_exit.pop();
}
history_save_all();
proc_destroy();
exit_without_destructors(exit_status);