summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-07-27 22:07:35 +0200
committerBram Moolenaar <Bram@vim.org>2017-07-27 22:07:35 +0200
commit0e83f02d80acacee55c5de3bbbee52625d368375 (patch)
treed93c8edcdf2f2679f4ca7fef079ca38b7ca52d9e
parentd28cc3f55d4a5a980f6ac6fa682382822a223720 (diff)
downloadvim-git-0e83f02d80acacee55c5de3bbbee52625d368375.tar.gz
patch 8.0.0783: job of terminal may be freed too earlyv8.0.0783
Problem: Job of terminal may be freed too early. Solution: Increment job refcount. (Yasuhiro Matsumoto)
-rw-r--r--src/terminal.c3
-rw-r--r--src/version.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 6f14b3f82..6d8679d39 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1247,6 +1247,7 @@ term_and_job_init(term_T *term, int rows, int cols, char_u *cmd)
job->jv_proc_info.dwProcessId = GetProcessId(child_process_handle);
job->jv_job_object = jo;
job->jv_status = JOB_STARTED;
+ ++job->jv_refcount;
term->tl_job = job;
return OK;
@@ -1329,6 +1330,8 @@ term_and_job_init(term_T *term, int rows, int cols, char_u *cmd)
argvars[0].vval.v_string = cmd;
setup_job_options(&opt, rows, cols);
term->tl_job = job_start(argvars, &opt);
+ if (term->tl_job != NULL)
+ ++term->tl_job->jv_refcount;
return term->tl_job != NULL
&& term->tl_job->jv_channel != NULL
diff --git a/src/version.c b/src/version.c
index da00188ce..1b13fd337 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 783,
+/**/
782,
/**/
781,