changeset 11802:b1fd49b4eea7 v8.0.0783

patch 8.0.0783: job of terminal may be freed too early commit https://github.com/vim/vim/commit/0e83f02d80acacee55c5de3bbbee52625d368375 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 27 22:07:35 2017 +0200 patch 8.0.0783: job of terminal may be freed too early Problem: Job of terminal may be freed too early. Solution: Increment job refcount. (Yasuhiro Matsumoto)
author Christian Brabandt <cb@256bit.org>
date Thu, 27 Jul 2017 22:15:04 +0200
parents ad0f51ab1159
children 2b560ad4ffce
files src/terminal.c src/version.c
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1247,6 +1247,7 @@ term_and_job_init(term_T *term, int rows
     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
     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
--- 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,