diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-23 17:00:46 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-23 21:19:08 -0300 |
commit | f05fead12e380fa63dc99ceb65332569e4e06c43 (patch) | |
tree | fad57dec162ec0bdce62ced00175128fd7bfe64a | |
parent | 6f5f3faa840a70e9e2b0a532f0f76c9a755421b9 (diff) | |
download | rneovim-f05fead12e380fa63dc99ceb65332569e4e06c43.tar.gz rneovim-f05fead12e380fa63dc99ceb65332569e4e06c43.tar.bz2 rneovim-f05fead12e380fa63dc99ceb65332569e4e06c43.zip |
job: Only decrease refcount after `settmode` in `job_wait`
This is required to prevent the scenario explained by @akkartik in #1324
-rw-r--r-- | src/nvim/os/job.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/nvim/os/job.c b/src/nvim/os/job.c index 947538af4b..caada5616b 100644 --- a/src/nvim/os/job.c +++ b/src/nvim/os/job.c @@ -291,7 +291,6 @@ int job_wait(Job *job, int ms) FUNC_ATTR_NONNULL_ALL // Until... got_int || // interrupted by the user job->refcount == 1); // job exited - job->refcount--; // we'll assume that a user frantically hitting interrupt doesn't like // the current job. Signal that it has to be killed. @@ -302,7 +301,7 @@ int job_wait(Job *job, int ms) FUNC_ATTR_NONNULL_ALL settmode(old_mode); - if (!job->refcount) { + if (!--job->refcount) { int status = (int) job->status; // Manually invoke close_cb to free the job resources close_cb((uv_handle_t *)&job->proc); |