summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1259
blob: f6ff2b1fd10477a10712038832a0984a81efc80f (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1259
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.1259
Problem:    Crash when exiting early. (Ralf Schandl)
Solution:   Only pop/push the title when it was set. (closes #4334)
Files:	    src/os_unix.c, src/misc2.c, src/usercmd.c, src/tag.c


*** ../vim-8.1.1258/src/os_unix.c	2019-05-02 23:00:19.227658452 +0200
--- src/os_unix.c	2019-05-03 22:56:29.021478366 +0200
***************
*** 2205,2218 ****
      void
  mch_restore_title(int which)
  {
      /* only restore the title or icon when it has been set */
      mch_settitle(((which & SAVE_RESTORE_TITLE) && did_set_title) ?
  			(oldtitle ? oldtitle : p_titleold) : NULL,
  	       ((which & SAVE_RESTORE_ICON) && did_set_icon) ? oldicon : NULL);
  
!     // pop and push from/to the stack
!     term_pop_title(which);
!     term_push_title(which);
  }
  
  #endif /* FEAT_TITLE */
--- 2205,2223 ----
      void
  mch_restore_title(int which)
  {
+     int	do_push_pop = did_set_title || did_set_icon;
+ 
      /* only restore the title or icon when it has been set */
      mch_settitle(((which & SAVE_RESTORE_TITLE) && did_set_title) ?
  			(oldtitle ? oldtitle : p_titleold) : NULL,
  	       ((which & SAVE_RESTORE_ICON) && did_set_icon) ? oldicon : NULL);
  
!     if (do_push_pop)
!     {
! 	// pop and push from/to the stack
! 	term_pop_title(which);
! 	term_push_title(which);
!     }
  }
  
  #endif /* FEAT_TITLE */
*** ../vim-8.1.1258/src/misc2.c	2019-04-28 19:46:17.030060105 +0200
--- src/misc2.c	2019-05-03 23:12:59.332791168 +0200
***************
*** 1068,1074 ****
  
      /* Close all tabs and windows.  Reset 'equalalways' to avoid redraws. */
      p_ea = FALSE;
!     if (first_tabpage->tp_next != NULL)
  	do_cmdline_cmd((char_u *)"tabonly!");
      if (!ONE_WINDOW)
  	do_cmdline_cmd((char_u *)"only!");
--- 1068,1074 ----
  
      /* Close all tabs and windows.  Reset 'equalalways' to avoid redraws. */
      p_ea = FALSE;
!     if (first_tabpage != NULL && first_tabpage->tp_next != NULL)
  	do_cmdline_cmd((char_u *)"tabonly!");
      if (!ONE_WINDOW)
  	do_cmdline_cmd((char_u *)"only!");
***************
*** 1085,1113 ****
      // Clear user commands (before deleting buffers).
      ex_comclear(NULL);
  
  # ifdef FEAT_MENU
!     /* Clear menus. */
!     do_cmdline_cmd((char_u *)"aunmenu *");
  #  ifdef FEAT_MULTI_LANG
!     do_cmdline_cmd((char_u *)"menutranslate clear");
  #  endif
  # endif
! 
!     /* Clear mappings, abbreviations, breakpoints. */
!     do_cmdline_cmd((char_u *)"lmapclear");
!     do_cmdline_cmd((char_u *)"xmapclear");
!     do_cmdline_cmd((char_u *)"mapclear");
!     do_cmdline_cmd((char_u *)"mapclear!");
!     do_cmdline_cmd((char_u *)"abclear");
  # if defined(FEAT_EVAL)
!     do_cmdline_cmd((char_u *)"breakdel *");
  # endif
  # if defined(FEAT_PROFILE)
!     do_cmdline_cmd((char_u *)"profdel *");
  # endif
  # if defined(FEAT_KEYMAP)
!     do_cmdline_cmd((char_u *)"set keymap=");
  #endif
  
  # ifdef FEAT_TITLE
      free_titles();
--- 1085,1117 ----
      // Clear user commands (before deleting buffers).
      ex_comclear(NULL);
  
+     // When exiting from mainerr_arg_missing curbuf has not been initialized,
+     // and not much else.
+     if (curbuf != NULL)
+     {
  # ifdef FEAT_MENU
! 	// Clear menus.
! 	do_cmdline_cmd((char_u *)"aunmenu *");
  #  ifdef FEAT_MULTI_LANG
! 	do_cmdline_cmd((char_u *)"menutranslate clear");
  #  endif
  # endif
! 	// Clear mappings, abbreviations, breakpoints.
! 	do_cmdline_cmd((char_u *)"lmapclear");
! 	do_cmdline_cmd((char_u *)"xmapclear");
! 	do_cmdline_cmd((char_u *)"mapclear");
! 	do_cmdline_cmd((char_u *)"mapclear!");
! 	do_cmdline_cmd((char_u *)"abclear");
  # if defined(FEAT_EVAL)
! 	do_cmdline_cmd((char_u *)"breakdel *");
  # endif
  # if defined(FEAT_PROFILE)
! 	do_cmdline_cmd((char_u *)"profdel *");
  # endif
  # if defined(FEAT_KEYMAP)
! 	do_cmdline_cmd((char_u *)"set keymap=");
  #endif
+     }
  
  # ifdef FEAT_TITLE
      free_titles();
***************
*** 1142,1148 ****
      set_expr_line(NULL);
  # endif
  # ifdef FEAT_DIFF
!     diff_clear(curtab);
  # endif
      clear_sb_text(TRUE);	      /* free any scrollback text */
  
--- 1146,1153 ----
      set_expr_line(NULL);
  # endif
  # ifdef FEAT_DIFF
!     if (curtab != NULL)
! 	diff_clear(curtab);
  # endif
      clear_sb_text(TRUE);	      /* free any scrollback text */
  
***************
*** 1172,1188 ****
  	tabpage_T   *tab;
  
  	qf_free_all(NULL);
! 	/* Free all location lists */
  	FOR_ALL_TAB_WINDOWS(tab, win)
  	    qf_free_all(win);
      }
  #endif
  
!     /* Close all script inputs. */
      close_all_scripts();
  
!     /* Destroy all windows.  Must come before freeing buffers. */
!     win_free_all();
  
      /* Free all option values.  Must come after closing windows. */
      free_all_options();
--- 1177,1194 ----
  	tabpage_T   *tab;
  
  	qf_free_all(NULL);
! 	// Free all location lists
  	FOR_ALL_TAB_WINDOWS(tab, win)
  	    qf_free_all(win);
      }
  #endif
  
!     // Close all script inputs.
      close_all_scripts();
  
!     if (curwin != NULL)
! 	// Destroy all windows.  Must come before freeing buffers.
! 	win_free_all();
  
      /* Free all option values.  Must come after closing windows. */
      free_all_options();
***************
*** 1223,1230 ****
  
      reset_last_sourcing();
  
!     free_tabpage(first_tabpage);
!     first_tabpage = NULL;
  
  # ifdef UNIX
      /* Machine-specific free. */
--- 1229,1239 ----
  
      reset_last_sourcing();
  
!     if (first_tabpage != NULL)
!     {
! 	free_tabpage(first_tabpage);
! 	first_tabpage = NULL;
!     }
  
  # ifdef UNIX
      /* Machine-specific free. */
*** ../vim-8.1.1258/src/usercmd.c	2019-05-01 18:08:38.267237229 +0200
--- src/usercmd.c	2019-05-03 22:58:19.848831337 +0200
***************
*** 1045,1051 ****
  ex_comclear(exarg_T *eap UNUSED)
  {
      uc_clear(&ucmds);
!     uc_clear(&curbuf->b_ucmds);
  }
  
  /*
--- 1045,1052 ----
  ex_comclear(exarg_T *eap UNUSED)
  {
      uc_clear(&ucmds);
!     if (curbuf != NULL)
! 	uc_clear(&curbuf->b_ucmds);
  }
  
  /*
*** ../vim-8.1.1258/src/tag.c	2019-04-29 19:47:19.399571862 +0200
--- src/tag.c	2019-05-03 23:01:48.623615434 +0200
***************
*** 2860,2866 ****
  free_tag_stuff(void)
  {
      ga_clear_strings(&tag_fnames);
!     do_tag(NULL, DT_FREE, 0, 0, 0);
      tag_freematch();
  
  # if defined(FEAT_QUICKFIX)
--- 2860,2867 ----
  free_tag_stuff(void)
  {
      ga_clear_strings(&tag_fnames);
!     if (curwin != NULL)
! 	do_tag(NULL, DT_FREE, 0, 0, 0);
      tag_freematch();
  
  # if defined(FEAT_QUICKFIX)
*** ../vim-8.1.1258/src/version.c	2019-05-03 22:25:36.292643839 +0200
--- src/version.c	2019-05-03 23:13:33.340662772 +0200
***************
*** 769,770 ****
--- 769,772 ----
  {   /* Add new patch number below this line */
+ /**/
+     1259,
  /**/

-- 
An indication you must be a manager:
You give constructive feedback to your dog.

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