]>
Commit | Line | Data |
---|---|---|
a328bbc4 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.0.054 | |
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.0.054 | |
11 | Problem: Mac: Using a menu name that only has a mnemonic or accelerator | |
12 | causes a crash. (Elliot Shank) | |
13 | Solution: Check for an empty menu name. Also delete empty submenus that | |
14 | were created before detecting the error. | |
15 | Files: src/menu.c | |
16 | ||
17 | ||
18 | *** ../vim-7.0.053/src/menu.c Wed May 3 23:28:47 2006 | |
19 | --- src/menu.c Tue Aug 8 20:53:25 2006 | |
20 | *************** | |
21 | *** 511,516 **** | |
22 | --- 511,524 ---- | |
23 | * name (without mnemonic and accelerator text). */ | |
24 | next_name = menu_name_skip(name); | |
25 | dname = menu_text(name, NULL, NULL); | |
26 | + if (dname == NULL) | |
27 | + goto erret; | |
28 | + if (*dname == NUL) | |
29 | + { | |
30 | + /* Only a mnemonic or accelerator is not valid. */ | |
31 | + EMSG(_("E792: Empty menu name")); | |
32 | + goto erret; | |
33 | + } | |
34 | ||
35 | /* See if it's already there */ | |
36 | lower_pri = menup; | |
37 | *************** | |
38 | *** 704,709 **** | |
39 | --- 712,718 ---- | |
40 | parent = menu; | |
41 | name = next_name; | |
42 | vim_free(dname); | |
43 | + dname = NULL; | |
44 | if (pri_tab[pri_idx + 1] != -1) | |
45 | ++pri_idx; | |
46 | } | |
47 | *************** | |
48 | *** 793,798 **** | |
49 | --- 802,823 ---- | |
50 | erret: | |
51 | vim_free(path_name); | |
52 | vim_free(dname); | |
53 | + | |
54 | + /* Delete any empty submenu we added before discovering the error. Repeat | |
55 | + * for higher levels. */ | |
56 | + while (parent != NULL && parent->children == NULL) | |
57 | + { | |
58 | + if (parent->parent == NULL) | |
59 | + menup = &root_menu; | |
60 | + else | |
61 | + menup = &parent->parent->children; | |
62 | + for ( ; *menup != NULL && *menup != parent; menup = &((*menup)->next)) | |
63 | + ; | |
64 | + if (*menup == NULL) /* safety check */ | |
65 | + break; | |
66 | + parent = parent->parent; | |
67 | + free_menu(menup); | |
68 | + } | |
69 | return FAIL; | |
70 | } | |
71 | ||
72 | *** ../vim-7.0.053/src/version.c Tue Aug 15 22:26:04 2006 | |
73 | --- src/version.c Wed Aug 16 15:53:39 2006 | |
74 | *************** | |
75 | *** 668,669 **** | |
76 | --- 668,671 ---- | |
77 | { /* Add new patch number below this line */ | |
78 | + /**/ | |
79 | + 54, | |
80 | /**/ | |
81 | ||
82 | -- | |
83 | hundred-and-one symptoms of being an internet addict: | |
84 | 156. You forget your friend's name but not her e-mail address. | |
85 | ||
86 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
87 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
88 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
89 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |