]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - vim/patches/vim-7.3.528.patch0
libnl3: New package.
[people/ms/ipfire-3.x.git] / vim / patches / vim-7.3.528.patch0
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.528
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.528
11 Problem: Crash when closing last window in a tab. (Alex Efros)
12 Solution: Use common code in close_last_window_tabpage(). (Christian
13 Brabandt)
14 Files: src/window.c
15
16
17 *** ../vim-7.3.527/src/window.c 2012-03-16 19:07:54.000000000 +0100
18 --- src/window.c 2012-05-25 12:25:16.000000000 +0200
19 ***************
20 *** 23,28 ****
21 --- 23,29 ----
22 static void win_totop __ARGS((int size, int flags));
23 static void win_equal_rec __ARGS((win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height));
24 static int last_window __ARGS((void));
25 + static int close_last_window_tabpage __ARGS((win_T *win, int free_buf, tabpage_T *prev_curtab));
26 static win_T *win_free_mem __ARGS((win_T *win, int *dirp, tabpage_T *tp));
27 static frame_T *win_altframe __ARGS((win_T *win, tabpage_T *tp));
28 static tabpage_T *alt_tabpage __ARGS((void));
29 ***************
30 *** 2105,2110 ****
31 --- 2106,2147 ----
32 }
33
34 /*
35 + * Close the possibly last window in a tab page.
36 + * Returns TRUE when the window was closed already.
37 + */
38 + static int
39 + close_last_window_tabpage(win, free_buf, prev_curtab)
40 + win_T *win;
41 + int free_buf;
42 + tabpage_T *prev_curtab;
43 + {
44 + if (firstwin == lastwin)
45 + {
46 + /*
47 + * Closing the last window in a tab page. First go to another tab
48 + * page and then close the window and the tab page. This avoids that
49 + * curwin and curtab are invalid while we are freeing memory, they may
50 + * be used in GUI events.
51 + */
52 + goto_tabpage_tp(alt_tabpage());
53 + redraw_tabline = TRUE;
54 +
55 + /* Safety check: Autocommands may have closed the window when jumping
56 + * to the other tab page. */
57 + if (valid_tabpage(prev_curtab) && prev_curtab->tp_firstwin == win)
58 + {
59 + int h = tabline_height();
60 +
61 + win_close_othertab(win, free_buf, prev_curtab);
62 + if (h != tabline_height())
63 + shell_new_rows();
64 + }
65 + return TRUE;
66 + }
67 + return FALSE;
68 + }
69 +
70 + /*
71 * Close window "win". Only works for the current tab page.
72 * If "free_buf" is TRUE related buffer may be unloaded.
73 *
74 ***************
75 *** 2143,2171 ****
76 }
77 #endif
78
79 ! /*
80 ! * When closing the last window in a tab page first go to another tab
81 ! * page and then close the window and the tab page. This avoids that
82 ! * curwin and curtab are not invalid while we are freeing memory, they may
83 ! * be used in GUI events.
84 ! */
85 ! if (firstwin == lastwin)
86 ! {
87 ! goto_tabpage_tp(alt_tabpage());
88 ! redraw_tabline = TRUE;
89 !
90 ! /* Safety check: Autocommands may have closed the window when jumping
91 ! * to the other tab page. */
92 ! if (valid_tabpage(prev_curtab) && prev_curtab->tp_firstwin == win)
93 ! {
94 ! int h = tabline_height();
95 !
96 ! win_close_othertab(win, free_buf, prev_curtab);
97 ! if (h != tabline_height())
98 ! shell_new_rows();
99 ! }
100 ! return;
101 ! }
102
103 /* When closing the help window, try restoring a snapshot after closing
104 * the window. Otherwise clear the snapshot, it's now invalid. */
105 --- 2180,2190 ----
106 }
107 #endif
108
109 ! /* When closing the last window in a tab page first go to another tab page
110 ! * and then close the window and the tab page to avoid that curwin and
111 ! * curtab are invalid while we are freeing memory. */
112 ! if (close_last_window_tabpage(win, free_buf, prev_curtab))
113 ! return;
114
115 /* When closing the help window, try restoring a snapshot after closing
116 * the window. Otherwise clear the snapshot, it's now invalid. */
117 ***************
118 *** 2225,2231 ****
119
120 /* Autocommands may have closed the window already, or closed the only
121 * other window or moved to another tab page. */
122 ! if (!win_valid(win) || last_window() || curtab != prev_curtab)
123 return;
124
125 /* Free the memory used for the window and get the window that received
126 --- 2244,2251 ----
127
128 /* Autocommands may have closed the window already, or closed the only
129 * other window or moved to another tab page. */
130 ! if (!win_valid(win) || last_window() || curtab != prev_curtab
131 ! || close_last_window_tabpage(win, free_buf, prev_curtab))
132 return;
133
134 /* Free the memory used for the window and get the window that received
135 ***************
136 *** 2310,2316 ****
137
138 /*
139 * Close window "win" in tab page "tp", which is not the current tab page.
140 ! * This may be the last window ih that tab page and result in closing the tab,
141 * thus "tp" may become invalid!
142 * Caller must check if buffer is hidden and whether the tabline needs to be
143 * updated.
144 --- 2330,2336 ----
145
146 /*
147 * Close window "win" in tab page "tp", which is not the current tab page.
148 ! * This may be the last window in that tab page and result in closing the tab,
149 * thus "tp" may become invalid!
150 * Caller must check if buffer is hidden and whether the tabline needs to be
151 * updated.
152 *** ../vim-7.3.527/src/version.c 2012-05-25 11:56:06.000000000 +0200
153 --- src/version.c 2012-05-25 12:38:25.000000000 +0200
154 ***************
155 *** 716,717 ****
156 --- 716,719 ----
157 { /* Add new patch number below this line */
158 + /**/
159 + 528,
160 /**/
161
162 --
163 For society, it's probably a good thing that engineers value function over
164 appearance. For example, you wouldn't want engineers to build nuclear power
165 plants that only _look_ like they would keep all the radiation inside.
166 (Scott Adams - The Dilbert principle)
167
168 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
169 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
170 \\\ an exciting new programming language -- http://www.Zimbu.org ///
171 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///