4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When ~/.vim/after/syntax/syncolor.vim contains a command that
12 reloads the colors an enless loop and/or a crash may occur.
13 Solution: Only free the old value of an option when it was originally
14 allocated. Limit recursiveness of init_highlight() to 5 levels.
15 Files: src/option.c, src/syntax.c
18 *** ../vim-6.3.025/src/option.c Thu Aug 26 16:01:15 2004
19 --- src/option.c Mon Sep 13 15:42:46 2004
24 int did_chartab = FALSE;
26 + int free_oldval = (options[opt_idx].flags & P_ALLOCED);
28 /* Get the global option to compare with, otherwise we would have to check
29 * two values for all local options. */
34 * Free string options that are in allocated memory.
36 ! if (options[opt_idx].flags & P_ALLOCED)
37 free_string_option(oldval);
38 if (new_value_alloced)
39 options[opt_idx].flags |= P_ALLOCED;
43 * Free string options that are in allocated memory.
44 + * Use "free_oldval", because recursiveness may change the flags under
45 + * our fingers (esp. init_highlight()).
48 free_string_option(oldval);
49 if (new_value_alloced)
50 options[opt_idx].flags |= P_ALLOCED;
51 *** ../vim-6.3.025/src/syntax.c Wed Jun 9 14:56:25 2004
52 --- src/syntax.c Mon Sep 13 15:44:04 2004
55 * If syntax highlighting is enabled load the highlighting for it.
57 if (get_var_value((char_u *)"g:syntax_on") != NULL)
58 ! (void)cmd_runtime((char_u *)"syntax/syncolor.vim", TRUE);
63 * If syntax highlighting is enabled load the highlighting for it.
65 if (get_var_value((char_u *)"g:syntax_on") != NULL)
67 ! static int recursive = 0;
70 ! EMSG(_("E679: recursive loop loading syncolor.vim"));
74 ! (void)cmd_runtime((char_u *)"syntax/syncolor.vim", TRUE);
81 *** ../vim-6.3.025/src/version.c Sun Sep 5 20:53:04 2004
82 --- src/version.c Mon Sep 13 16:33:19 2004
86 { /* Add new patch number below this line */
92 A special law prohibits unmarried women from parachuting on Sunday or she
93 shall risk arrest, fine, and/or jailing.
94 [real standing law in Florida, United States of America]
96 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
97 /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
98 \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
99 \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///