diff src/channel.c @ 11939:ef1febf04d03 v8.0.0849

patch 8.0.0849: crash when job exit callback wipes the terminal commit https://github.com/vim/vim/commit/3c3a80dc59ccc0e0aabb9c8bd58ea84a801dbfc1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 3 17:06:45 2017 +0200 patch 8.0.0849: crash when job exit callback wipes the terminal Problem: Crash when job exit callback wipes the terminal. Solution: Check for b_term to be NULL. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/1922) Implement options for term_start() to be able to test. Make term_wait() more reliable.
author Christian Brabandt <cb@256bit.org>
date Thu, 03 Aug 2017 17:15:04 +0200
parents c893d6c00497
children 91a26b7a4119
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -4160,7 +4160,6 @@ get_job_options(typval_T *tv, jobopt_T *
     hashitem_T	*hi;
     ch_part_T	part;
 
-    opt->jo_set = 0;
     if (tv->v_type == VAR_UNKNOWN)
 	return OK;
     if (tv->v_type != VAR_DICT)
@@ -4616,6 +4615,7 @@ job_cleanup(job_T *job)
 	int		dummy;
 
 	/* Invoke the exit callback. Make sure the refcount is > 0. */
+	ch_log(job->jv_channel, "Invoking exit callback %s", job->jv_exit_cb);
 	++job->jv_refcount;
 	argv[0].v_type = VAR_JOB;
 	argv[0].vval.v_job = job;
@@ -4888,7 +4888,7 @@ job_start(typval_T *argvars, jobopt_T *o
 	if (get_job_options(&argvars[1], &opt,
 	    JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT
 			   + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL)
-	goto theend;
+	    goto theend;
     }
 
     /* Check that when io is "file" that there is a file name. */