summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0847
blob: 7b5fa9535cef6bd72b7142d727f8bce31bdd8e78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0847
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
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    ///