From f05fead12e380fa63dc99ceb65332569e4e06c43 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Thu, 23 Oct 2014 17:00:46 -0300 Subject: job: Only decrease refcount after `settmode` in `job_wait` This is required to prevent the scenario explained by @akkartik in #1324 --- src/nvim/os/job.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') 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); -- cgit