]> granicus.if.org Git - vim/commitdiff
patch 8.0.0783: job of terminal may be freed too early v8.0.0783
authorBram Moolenaar <Bram@vim.org>
Thu, 27 Jul 2017 20:07:35 +0000 (22:07 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 27 Jul 2017 20:07:35 +0000 (22:07 +0200)
Problem:    Job of terminal may be freed too early.
Solution:   Increment job refcount. (Yasuhiro Matsumoto)

src/terminal.c
src/version.c

index 6f14b3f82ac490230fd155e7d6eeaa28810cb081..6d8679d3935d02a0af82067a166fafae835d21a8 100644 (file)
@@ -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
index da00188ce0bbb95cbfe186a14d77b3580a17d090..1b13fd337857004e94c0a3c4bd7f77452d2a7d2b 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    783,
 /**/
     782,
 /**/