summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-29 23:06:54 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-29 23:06:54 +0100
commit9172d23d05f3f25996e03612654920b01158d734 (patch)
treee02c1ef475ffff86b544829dd02e9bb96e03cc70
parent39536dd557e847e80572044c2be319db5886abe3 (diff)
downloadvim-git-9172d23d05f3f25996e03612654920b01158d734.tar.gz
patch 8.1.0847: may use terminal after it was cleaned upv8.1.0847
Problem: May use terminal after it was cleaned up. Solution: Use the job pointer.
-rw-r--r--src/terminal.c15
-rw-r--r--src/version.c2
2 files changed, 12 insertions, 5 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 87530af2e..760591443 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1375,19 +1375,24 @@ term_try_stop_job(buf_T *buf)
job_stop(buf->b_term->tl_job, NULL, how);
- /* wait for up to a second for the job to die */
+ // wait for up to a second for the job to die
for (count = 0; count < 100; ++count)
{
- /* buffer, terminal and job may be cleaned up while waiting */
+ job_T *job;
+
+ // buffer, terminal and job may be cleaned up while waiting
if (!buf_valid(buf)
|| buf->b_term == NULL
|| buf->b_term->tl_job == NULL)
return OK;
+ job = buf->b_term->tl_job;
- /* call job_status() to update jv_status */
- job_status(buf->b_term->tl_job);
- if (buf->b_term->tl_job->jv_status >= JOB_ENDED)
+ // Call job_status() to update jv_status. It may cause the job to be
+ // cleaned up but it won't be freed.
+ job_status(job);
+ if (job->jv_status >= JOB_ENDED)
return OK;
+
ui_delay(10L, FALSE);
mch_check_messages();
parse_queued_messages();
diff --git a/src/version.c b/src/version.c
index f693b660e..729f65017 100644
--- a/src/version.c
+++ b/src/version.c
@@ -784,6 +784,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 847,
+/**/
846,
/**/
845,