4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
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
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;
27 int save_ex_normal_busy;
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
36 save_ex_normal_busy = ex_normal_busy;
40 save_typeahead(&typeaheadbuf);
42 cmdline = getcmdline_prompt('>', NULL, 0, EXPAND_NOTHING, NULL);
45 restore_typeahead(&typeaheadbuf);
47 ex_normal_busy = save_ex_normal_busy;
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. */
55 save_ex_normal_busy = ex_normal_busy;
60 save_typeahead(&typeaheadbuf);
61 + typeahead_saved = TRUE;
62 + save_ignore_script = ignore_script;
63 + ignore_script = TRUE;
66 cmdline = getcmdline_prompt('>', NULL, 0, EXPAND_NOTHING, NULL);
68 ! if (typeahead_saved)
70 restore_typeahead(&typeaheadbuf);
71 + ignore_script = save_ignore_script;
74 ex_normal_busy = save_ex_normal_busy;
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
83 ! vim_free(typebuf.tb_buf);
84 ! vim_free(typebuf.tb_noremap);
92 ! if (typebuf.tb_buf == typebuf_init)
93 ! EMSG2(_(e_intern2), "Free typebuf 1");
95 ! vim_free(typebuf.tb_buf);
96 ! if (typebuf.tb_buf == noremapbuf_init)
97 ! EMSG2(_(e_intern2), "Free typebuf 2");
99 ! vim_free(typebuf.tb_noremap);
111 + /* Not reading from script, also don't open one. Warning message? */
115 if (scriptin[curscript] != NULL) /* already reading script */
119 current_menu->silent[idx]);
122 ! #endif /* FEAT_GUI */
123 continue; /* try mapping again */
127 current_menu->silent[idx]);
130 ! #endif /* FEAT_GUI && FEAT_MENU */
131 continue; /* try mapping again */
136 undo_off = FALSE; /* restart undo now */
139 ! * first try script file
140 ! * If interrupted: Stop reading script files.
143 ! while (scriptin[curscript] != NULL && script_char < 0)
145 if (got_int || (script_char = getc(scriptin[curscript])) < 0)
148 undo_off = FALSE; /* restart undo now */
151 ! * Get a character from a script file if there is one.
152 ! * If interrupted: Stop reading script files, close them all.
155 ! while (scriptin[curscript] != NULL && script_char < 0
161 if (got_int || (script_char = getc(scriptin[curscript])) < 0)
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
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() */
172 + EXTERN int ignore_script INIT(= FALSE); /* ignore script input */
174 EXTERN int stop_insert_mode; /* for ":stopinsert" and 'insertmode' */
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
182 { /* Add new patch number below this line */
188 Back up my hard drive? I can't find the reverse switch!
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 ///