To: vim_dev@googlegroups.com Subject: Patch 8.1.0847 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0847 Problem: May use terminal after it was cleaned up. Solution: Use the job pointer. Files: src/terminal.c *** ../vim-8.1.0846/src/terminal.c 2019-01-29 22:29:03.550799929 +0100 --- src/terminal.c 2019-01-29 23:04:59.930003181 +0100 *************** *** 1375,1393 **** job_stop(buf->b_term->tl_job, NULL, how); ! /* 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 */ if (!buf_valid(buf) || buf->b_term == NULL || buf->b_term->tl_job == NULL) return OK; ! /* call job_status() to update jv_status */ ! job_status(buf->b_term->tl_job); ! if (buf->b_term->tl_job->jv_status >= JOB_ENDED) return OK; ui_delay(10L, FALSE); mch_check_messages(); parse_queued_messages(); --- 1375,1398 ---- job_stop(buf->b_term->tl_job, NULL, how); ! // wait for up to a second for the job to die for (count = 0; count < 100; ++count) { ! 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. 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(); *** ../vim-8.1.0846/src/version.c 2019-01-29 22:58:02.401136295 +0100 --- src/version.c 2019-01-29 23:06:03.985525682 +0100 *************** *** 785,786 **** --- 785,788 ---- { /* Add new patch number below this line */ + /**/ + 847, /**/ -- ARTHUR: I command you as King of the Britons to stand aside! BLACK KNIGHT: I move for no man. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///