mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.1.0847: may use terminal after it was cleaned up
Problem: May use terminal after it was cleaned up. Solution: Use the job pointer.
This commit is contained in:
@@ -1375,19 +1375,24 @@ term_try_stop_job(buf_T *buf)
|
|||||||
|
|
||||||
job_stop(buf->b_term->tl_job, NULL, how);
|
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)
|
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)
|
if (!buf_valid(buf)
|
||||||
|| buf->b_term == NULL
|
|| buf->b_term == NULL
|
||||||
|| buf->b_term->tl_job == NULL)
|
|| buf->b_term->tl_job == NULL)
|
||||||
return OK;
|
return OK;
|
||||||
|
job = buf->b_term->tl_job;
|
||||||
|
|
||||||
/* call job_status() to update jv_status */
|
// Call job_status() to update jv_status. It may cause the job to be
|
||||||
job_status(buf->b_term->tl_job);
|
// cleaned up but it won't be freed.
|
||||||
if (buf->b_term->tl_job->jv_status >= JOB_ENDED)
|
job_status(job);
|
||||||
|
if (job->jv_status >= JOB_ENDED)
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
ui_delay(10L, FALSE);
|
ui_delay(10L, FALSE);
|
||||||
mch_check_messages();
|
mch_check_messages();
|
||||||
parse_queued_messages();
|
parse_queued_messages();
|
||||||
|
@@ -783,6 +783,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
847,
|
||||||
/**/
|
/**/
|
||||||
846,
|
846,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user