]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.306
- new
[packages/vim.git] / 7.3.306
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.306
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.306
11 Problem:    When closing a window there is a chance that deleting a scrollbar
12             triggers a GUI resize, which uses the window while it is not in a
13             valid state.
14 Solution:   Set the buffer pointer to NULL to be able to detect the invalid
15             situation.  Fix a few places that used the buffer pointer
16             incorrectly.
17 Files:      src/buffer.c, src/ex_cmds.c, src/term.c, src/window.c
18
19
20 *** ../vim-7.3.305/src/buffer.c 2011-05-19 13:40:47.000000000 +0200
21 --- src/buffer.c        2011-09-10 13:46:59.000000000 +0200
22 ***************
23 *** 416,421 ****
24 --- 416,423 ----
25   #endif
26   
27       buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
28 +     if (win_valid(win) && win->w_buffer == buf)
29 +       win->w_buffer = NULL;  /* make sure we don't use the buffer now */
30   
31   #ifdef FEAT_AUTOCMD
32       /* Autocommands may have deleted the buffer. */
33 ***************
34 *** 560,565 ****
35 --- 562,571 ----
36   #ifdef FEAT_DIFF
37       diff_buf_delete(buf);         /* Can't use 'diff' for unloaded buffer. */
38   #endif
39 + #ifdef FEAT_SYN_HL
40 +     if (curwin->w_buffer == buf)
41 +       reset_synblock(curwin);     /* remove any ownsyntax */
42 + #endif
43   
44   #ifdef FEAT_FOLDING
45       /* No folds in an empty buffer. */
46 ***************
47 *** 1346,1351 ****
48 --- 1352,1361 ----
49   # endif
50   #endif
51       {
52 + #ifdef FEAT_SYN_HL
53 +       if (prevbuf == curwin->w_buffer)
54 +           reset_synblock(curwin);
55 + #endif
56   #ifdef FEAT_WINDOWS
57         if (unload)
58             close_windows(prevbuf, FALSE);
59 ***************
60 *** 1395,1404 ****
61       foldUpdateAll(curwin);    /* update folds (later). */
62   #endif
63   
64 - #ifdef FEAT_SYN_HL
65 -     reset_synblock(curwin);
66 -     curwin->w_s = &(buf->b_s);
67 - #endif
68       /* Get the buffer in the current window. */
69       curwin->w_buffer = buf;
70       curbuf = buf;
71 --- 1405,1410 ----
72 ***************
73 *** 1409,1414 ****
74 --- 1415,1424 ----
75         diff_buf_add(curbuf);
76   #endif
77   
78 + #ifdef FEAT_SYN_HL
79 +     curwin->w_s = &(buf->b_s);
80 + #endif
81
82       /* Cursor on first line by default. */
83       curwin->w_cursor.lnum = 1;
84       curwin->w_cursor.col = 0;
85 *** ../vim-7.3.305/src/ex_cmds.c        2011-07-07 16:20:45.000000000 +0200
86 --- src/ex_cmds.c       2011-09-10 13:39:13.000000000 +0200
87 ***************
88 *** 3619,3628 ****
89        */
90       check_arg_idx(curwin);
91   
92 - #ifdef FEAT_SYN_HL
93 -     reset_synblock(curwin);       /* remove any ownsyntax */
94 - #endif
95
96   #ifdef FEAT_AUTOCMD
97       if (!auto_buf)
98   #endif
99 --- 3619,3624 ----
100 *** ../vim-7.3.305/src/term.c   2011-05-10 16:41:13.000000000 +0200
101 --- src/term.c  2011-09-14 14:39:39.000000000 +0200
102 ***************
103 *** 3017,3028 ****
104       if (width < 0 || height < 0)    /* just checking... */
105         return;
106   
107 !     if (State == HITRETURN || State == SETWSIZE) /* postpone the resizing */
108       {
109         State = SETWSIZE;
110         return;
111       }
112   
113       ++busy;
114   
115   #ifdef AMIGA
116 --- 3017,3036 ----
117       if (width < 0 || height < 0)    /* just checking... */
118         return;
119   
120 !     if (State == HITRETURN || State == SETWSIZE)
121       {
122 +       /* postpone the resizing */
123         State = SETWSIZE;
124         return;
125       }
126   
127 +     /* curwin->w_buffer can be NULL when we are closing a window and the
128 +      * buffer has already been closed and removing a scrollbar causes a resize
129 +      * event. Don't resize then, it will happen after entering another buffer.
130 +      */
131 +     if (curwin->w_buffer == NULL)
132 +       return;
133
134       ++busy;
135   
136   #ifdef AMIGA
137 *** ../vim-7.3.305/src/window.c 2011-01-08 14:45:57.000000000 +0100
138 --- src/window.c        2011-09-10 14:04:56.000000000 +0200
139 ***************
140 *** 1226,1240 ****
141       }
142       newp->w_tagstackidx = oldp->w_tagstackidx;
143       newp->w_tagstacklen = oldp->w_tagstacklen;
144 ! # ifdef FEAT_FOLDING
145       copyFoldingState(oldp, newp);
146 ! # endif
147   
148       win_init_some(newp, oldp);
149   
150 ! # ifdef FEAT_SYN_HL
151       check_colorcolumn(newp);
152 ! # endif
153   }
154   
155   /*
156 --- 1226,1240 ----
157       }
158       newp->w_tagstackidx = oldp->w_tagstackidx;
159       newp->w_tagstacklen = oldp->w_tagstacklen;
160 ! #ifdef FEAT_FOLDING
161       copyFoldingState(oldp, newp);
162 ! #endif
163   
164       win_init_some(newp, oldp);
165   
166 ! #ifdef FEAT_SYN_HL
167       check_colorcolumn(newp);
168 ! #endif
169   }
170   
171   /*
172 ***************
173 *** 2212,2217 ****
174 --- 2212,2222 ----
175         out_flush();
176   #endif
177   
178 + #ifdef FEAT_SYN_HL
179 +     /* Free independent synblock before the buffer is freed. */
180 +     reset_synblock(win);
181 + #endif
182
183       /*
184        * Close the link to the buffer.
185        */
186 ***************
187 *** 2222,2228 ****
188       if (!win_valid(win) || last_window() || curtab != prev_curtab)
189         return;
190   
191 !     /* Free the memory used for the window. */
192       wp = win_free_mem(win, &dir, NULL);
193   
194       /* Make sure curwin isn't invalid.  It can cause severe trouble when
195 --- 2227,2234 ----
196       if (!win_valid(win) || last_window() || curtab != prev_curtab)
197         return;
198   
199 !     /* Free the memory used for the window and get the window that received
200 !      * the screen space. */
201       wp = win_free_mem(win, &dir, NULL);
202   
203       /* Make sure curwin isn't invalid.  It can cause severe trouble when
204 ***************
205 *** 3247,3252 ****
206 --- 3253,3261 ----
207       else
208         wp->w_farsi = W_CONV;
209   #endif
210 + #ifdef FEAT_SYN_HL
211 +     wp->w_s = &wp->w_buffer->b_s;
212 + #endif
213   }
214   
215   /*
216 ***************
217 *** 4437,4443 ****
218   #endif /* FEAT_GUI */
219   
220   #ifdef FEAT_SYN_HL
221 -     reset_synblock(wp);  /* free independent synblock */
222       vim_free(wp->w_p_cc_cols);
223   #endif
224   
225 --- 4446,4451 ----
226 *** ../vim-7.3.305/src/version.c        2011-09-14 14:33:47.000000000 +0200
227 --- src/version.c       2011-09-14 14:35:30.000000000 +0200
228 ***************
229 *** 711,712 ****
230 --- 711,714 ----
231   {   /* Add new patch number below this line */
232 + /**/
233 +     306,
234   /**/
235
236 -- 
237 A consultant is a person who takes your money and annoys your employees while
238 tirelessly searching for the best way to extend the consulting contract.
239                                 (Scott Adams - The Dilbert principle)
240
241  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
242 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
243 \\\  an exciting new programming language -- http://www.Zimbu.org        ///
244  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.039859 seconds and 3 git commands to generate.