]>
Commit | Line | Data |
---|---|---|
d2415672 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.177 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.177 | |
11 | Problem: Freeing memory twice when in debug mode while reading a script. | |
12 | Solution: Ignore script input while in debug mode. | |
13 | Files: src/ex_cmds2.c, src/getchar.c, src/globals.h | |
14 | ||
15 | ||
16 | *** ../vim-7.1.176/src/ex_cmds2.c Thu May 10 20:55:46 2007 | |
17 | --- src/ex_cmds2.c Tue Jan 1 14:13:41 2008 | |
18 | *************** | |
19 | *** 93,98 **** | |
20 | --- 93,100 ---- | |
21 | int save_emsg_silent = emsg_silent; | |
22 | int save_redir_off = redir_off; | |
23 | tasave_T typeaheadbuf; | |
24 | + int typeahead_saved = FALSE; | |
25 | + int save_ignore_script; | |
26 | # ifdef FEAT_EX_EXTRA | |
27 | int save_ex_normal_busy; | |
28 | # endif | |
29 | *************** | |
30 | *** 159,176 **** | |
31 | * This makes sure we get input from the user here and don't interfere | |
32 | * with the commands being executed. Reset "ex_normal_busy" to avoid | |
33 | * the side effects of using ":normal". Save the stuff buffer and make | |
34 | ! * it empty. */ | |
35 | # ifdef FEAT_EX_EXTRA | |
36 | save_ex_normal_busy = ex_normal_busy; | |
37 | ex_normal_busy = 0; | |
38 | # endif | |
39 | if (!debug_greedy) | |
40 | save_typeahead(&typeaheadbuf); | |
41 | ||
42 | cmdline = getcmdline_prompt('>', NULL, 0, EXPAND_NOTHING, NULL); | |
43 | ||
44 | ! if (!debug_greedy) | |
45 | restore_typeahead(&typeaheadbuf); | |
46 | # ifdef FEAT_EX_EXTRA | |
47 | ex_normal_busy = save_ex_normal_busy; | |
48 | # endif | |
49 | --- 161,186 ---- | |
50 | * This makes sure we get input from the user here and don't interfere | |
51 | * with the commands being executed. Reset "ex_normal_busy" to avoid | |
52 | * the side effects of using ":normal". Save the stuff buffer and make | |
53 | ! * it empty. Set ignore_script to avoid reading from script input. */ | |
54 | # ifdef FEAT_EX_EXTRA | |
55 | save_ex_normal_busy = ex_normal_busy; | |
56 | ex_normal_busy = 0; | |
57 | # endif | |
58 | if (!debug_greedy) | |
59 | + { | |
60 | save_typeahead(&typeaheadbuf); | |
61 | + typeahead_saved = TRUE; | |
62 | + save_ignore_script = ignore_script; | |
63 | + ignore_script = TRUE; | |
64 | + } | |
65 | ||
66 | cmdline = getcmdline_prompt('>', NULL, 0, EXPAND_NOTHING, NULL); | |
67 | ||
68 | ! if (typeahead_saved) | |
69 | ! { | |
70 | restore_typeahead(&typeaheadbuf); | |
71 | + ignore_script = save_ignore_script; | |
72 | + } | |
73 | # ifdef FEAT_EX_EXTRA | |
74 | ex_normal_busy = save_ex_normal_busy; | |
75 | # endif | |
76 | *** ../vim-7.1.176/src/getchar.c Fri Dec 7 17:30:04 2007 | |
77 | --- src/getchar.c Tue Jan 1 14:11:42 2008 | |
78 | *************** | |
79 | *** 1279,1286 **** | |
80 | void | |
81 | free_typebuf() | |
82 | { | |
83 | ! vim_free(typebuf.tb_buf); | |
84 | ! vim_free(typebuf.tb_noremap); | |
85 | } | |
86 | ||
87 | /* | |
88 | --- 1279,1292 ---- | |
89 | void | |
90 | free_typebuf() | |
91 | { | |
92 | ! if (typebuf.tb_buf == typebuf_init) | |
93 | ! EMSG2(_(e_intern2), "Free typebuf 1"); | |
94 | ! else | |
95 | ! vim_free(typebuf.tb_buf); | |
96 | ! if (typebuf.tb_buf == noremapbuf_init) | |
97 | ! EMSG2(_(e_intern2), "Free typebuf 2"); | |
98 | ! else | |
99 | ! vim_free(typebuf.tb_noremap); | |
100 | } | |
101 | ||
102 | /* | |
103 | *************** | |
104 | *** 1359,1364 **** | |
105 | --- 1365,1375 ---- | |
106 | EMSG(_(e_nesting)); | |
107 | return; | |
108 | } | |
109 | + #ifdef FEAT_EVAL | |
110 | + if (ignore_script) | |
111 | + /* Not reading from script, also don't open one. Warning message? */ | |
112 | + return; | |
113 | + #endif | |
114 | ||
115 | if (scriptin[curscript] != NULL) /* already reading script */ | |
116 | ++curscript; | |
117 | *************** | |
118 | *** 2346,2352 **** | |
119 | current_menu->silent[idx]); | |
120 | } | |
121 | } | |
122 | ! #endif /* FEAT_GUI */ | |
123 | continue; /* try mapping again */ | |
124 | } | |
125 | ||
126 | --- 2357,2363 ---- | |
127 | current_menu->silent[idx]); | |
128 | } | |
129 | } | |
130 | ! #endif /* FEAT_GUI && FEAT_MENU */ | |
131 | continue; /* try mapping again */ | |
132 | } | |
133 | ||
134 | *************** | |
135 | *** 2862,2872 **** | |
136 | undo_off = FALSE; /* restart undo now */ | |
137 | ||
138 | /* | |
139 | ! * first try script file | |
140 | ! * If interrupted: Stop reading script files. | |
141 | */ | |
142 | script_char = -1; | |
143 | ! while (scriptin[curscript] != NULL && script_char < 0) | |
144 | { | |
145 | if (got_int || (script_char = getc(scriptin[curscript])) < 0) | |
146 | { | |
147 | --- 2873,2887 ---- | |
148 | undo_off = FALSE; /* restart undo now */ | |
149 | ||
150 | /* | |
151 | ! * Get a character from a script file if there is one. | |
152 | ! * If interrupted: Stop reading script files, close them all. | |
153 | */ | |
154 | script_char = -1; | |
155 | ! while (scriptin[curscript] != NULL && script_char < 0 | |
156 | ! #ifdef FEAT_EVAL | |
157 | ! && !ignore_script | |
158 | ! #endif | |
159 | ! ) | |
160 | { | |
161 | if (got_int || (script_char = getc(scriptin[curscript])) < 0) | |
162 | { | |
163 | *** ../vim-7.1.176/src/globals.h Sat Sep 29 14:15:00 2007 | |
164 | --- src/globals.h Mon Dec 31 17:00:21 2007 | |
165 | *************** | |
166 | *** 954,959 **** | |
167 | --- 954,962 ---- | |
168 | EXTERN int ex_normal_busy INIT(= 0); /* recursiveness of ex_normal() */ | |
169 | EXTERN int ex_normal_lock INIT(= 0); /* forbid use of ex_normal() */ | |
170 | #endif | |
171 | + #ifdef FEAT_EVAL | |
172 | + EXTERN int ignore_script INIT(= FALSE); /* ignore script input */ | |
173 | + #endif | |
174 | EXTERN int stop_insert_mode; /* for ":stopinsert" and 'insertmode' */ | |
175 | ||
176 | EXTERN int KeyTyped; /* TRUE if user typed current char */ | |
177 | *** ../vim-7.1.176/src/version.c Mon Dec 31 16:41:31 2007 | |
178 | --- src/version.c Tue Jan 1 14:00:09 2008 | |
179 | *************** | |
180 | *** 668,669 **** | |
181 | --- 668,671 ---- | |
182 | { /* Add new patch number below this line */ | |
183 | + /**/ | |
184 | + 177, | |
185 | /**/ | |
186 | ||
187 | -- | |
188 | Back up my hard drive? I can't find the reverse switch! | |
189 | ||
190 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
191 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
192 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
193 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |