summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0400
blob: ded7bfb9c7dbc6756f1a8ed9f03ea41798886a15 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0400
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.0400
Problem:    Using freed memory with :diffget.
Solution:   Skip ex_diffupdate() while updating diffs. (closes #3442)
Files:	    src/diff.c


*** ../vim-8.1.0399/src/diff.c	2018-09-16 15:47:45.629425398 +0200
--- src/diff.c	2018-09-16 18:05:01.223981230 +0200
***************
*** 21,27 ****
  
  #if defined(FEAT_DIFF) || defined(PROTO)
  
! static int	diff_busy = FALSE;	/* ex_diffgetput() is busy */
  
  /* flags obtained from the 'diffopt' option */
  #define DIFF_FILLER	0x001	// display filler lines
--- 21,28 ----
  
  #if defined(FEAT_DIFF) || defined(PROTO)
  
! static int diff_busy = FALSE;	    // using diff structs, don't change them
! static int diff_need_update = FALSE; // ex_diffupdate needs to be called
  
  /* flags obtained from the 'diffopt' option */
  #define DIFF_FILLER	0x001	// display filler lines
***************
*** 908,913 ****
--- 909,920 ----
      int		idx_new;
      diffio_T	diffio;
  
+     if (diff_busy)
+     {
+ 	diff_need_update = TRUE;
+ 	return;
+     }
+ 
      // Delete all diffblocks.
      diff_clear(curtab);
      curtab->tp_diff_invalid = FALSE;
***************
*** 2660,2666 ****
  	if (diff_buf_idx(curbuf) != idx_to)
  	{
  	    EMSG(_("E787: Buffer changed unexpectedly"));
! 	    return;
  	}
      }
  
--- 2667,2673 ----
  	if (diff_buf_idx(curbuf) != idx_to)
  	{
  	    EMSG(_("E787: Buffer changed unexpectedly"));
! 	    goto theend;
  	}
      }
  
***************
*** 2831,2837 ****
--- 2838,2850 ----
  	aucmd_restbuf(&aco);
      }
  
+ theend:
      diff_busy = FALSE;
+     if (diff_need_update)
+     {
+ 	diff_need_update = FALSE;
+ 	ex_diffupdate(NULL);
+     }
  
      /* Check that the cursor is on a valid character and update it's position.
       * When there were filler lines the topline has become invalid. */
*** ../vim-8.1.0399/src/version.c	2018-09-16 17:07:40.125853848 +0200
--- src/version.c	2018-09-16 18:09:16.718696612 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     400,
  /**/

-- 
Q: How many legs does a giraffe have?
A: Eight: two in front, two behind, two on the left and two on the right

 /// 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    ///