Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
11938:4aeeb22b875d | 11939:ef1febf04d03 |
---|---|
4158 dict_T *dict; | 4158 dict_T *dict; |
4159 int todo; | 4159 int todo; |
4160 hashitem_T *hi; | 4160 hashitem_T *hi; |
4161 ch_part_T part; | 4161 ch_part_T part; |
4162 | 4162 |
4163 opt->jo_set = 0; | |
4164 if (tv->v_type == VAR_UNKNOWN) | 4163 if (tv->v_type == VAR_UNKNOWN) |
4165 return OK; | 4164 return OK; |
4166 if (tv->v_type != VAR_DICT) | 4165 if (tv->v_type != VAR_DICT) |
4167 { | 4166 { |
4168 EMSG(_(e_invarg)); | 4167 EMSG(_(e_invarg)); |
4614 typval_T argv[3]; | 4613 typval_T argv[3]; |
4615 typval_T rettv; | 4614 typval_T rettv; |
4616 int dummy; | 4615 int dummy; |
4617 | 4616 |
4618 /* Invoke the exit callback. Make sure the refcount is > 0. */ | 4617 /* Invoke the exit callback. Make sure the refcount is > 0. */ |
4618 ch_log(job->jv_channel, "Invoking exit callback %s", job->jv_exit_cb); | |
4619 ++job->jv_refcount; | 4619 ++job->jv_refcount; |
4620 argv[0].v_type = VAR_JOB; | 4620 argv[0].v_type = VAR_JOB; |
4621 argv[0].vval.v_job = job; | 4621 argv[0].vval.v_job = job; |
4622 argv[1].v_type = VAR_NUMBER; | 4622 argv[1].v_type = VAR_NUMBER; |
4623 argv[1].vval.v_number = job->jv_exitval; | 4623 argv[1].vval.v_number = job->jv_exitval; |
4886 clear_job_options(&opt); | 4886 clear_job_options(&opt); |
4887 opt.jo_mode = MODE_NL; | 4887 opt.jo_mode = MODE_NL; |
4888 if (get_job_options(&argvars[1], &opt, | 4888 if (get_job_options(&argvars[1], &opt, |
4889 JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT | 4889 JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT |
4890 + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL) | 4890 + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL) |
4891 goto theend; | 4891 goto theend; |
4892 } | 4892 } |
4893 | 4893 |
4894 /* Check that when io is "file" that there is a file name. */ | 4894 /* Check that when io is "file" that there is a file name. */ |
4895 for (part = PART_OUT; part < PART_COUNT; ++part) | 4895 for (part = PART_OUT; part < PART_COUNT; ++part) |
4896 if ((opt.jo_set & (JO_OUT_IO << (part - PART_OUT))) | 4896 if ((opt.jo_set & (JO_OUT_IO << (part - PART_OUT))) |