| To: vim-dev@vim.org |
| Subject: Patch 7.0.062 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.0.062 |
| Problem: Mac: Crash when using the popup menu for spell correction. The |
| popup menu appears twice when letting go of the right mouse button |
| early. |
| Solution: Don't show the popup menu on the release of the right mouse |
| button. Also check that a menu pointer is actually valid. |
| Files: src/proto/menu.pro, src/menu.c, src/normal.c, src/term.c |
| |
| |
| |
| |
| |
| *** 10,15 **** |
| --- 10,16 ---- |
| extern int menu_is_child_of_popup __ARGS((vimmenu_T *menu)); |
| extern int menu_is_toolbar __ARGS((char_u *name)); |
| extern int menu_is_separator __ARGS((char_u *name)); |
| + extern int check_menu_pointer __ARGS((vimmenu_T *root, vimmenu_T *menu_to_check)); |
| extern void gui_create_initial_menus __ARGS((vimmenu_T *menu)); |
| extern void gui_update_menus __ARGS((int modes)); |
| extern int gui_is_menu_shortcut __ARGS((int key)); |
| |
| |
| |
| *** 1778,1783 **** |
| --- 1778,1804 ---- |
| } |
| |
| /* |
| + * Check that a pointer appears in the menu tree. Used to protect from using |
| + * a menu that was deleted after it was selected but before the event was |
| + * handled. |
| + * Return OK or FAIL. Used recursively. |
| + */ |
| + int |
| + check_menu_pointer(root, menu_to_check) |
| + vimmenu_T *root; |
| + vimmenu_T *menu_to_check; |
| + { |
| + vimmenu_T *p; |
| + |
| + for (p = root; p != NULL; p = p->next) |
| + if (p == menu_to_check |
| + || (p->children != NULL |
| + && check_menu_pointer(p->children, menu_to_check) == OK)) |
| + return OK; |
| + return FAIL; |
| + } |
| + |
| + /* |
| * After we have started the GUI, then we can create any menus that have been |
| * defined. This is done once here. add_menu_path() may have already been |
| * called to define these menus, and may be called again. This function calls |
| |
| |
| |
| *** 2504,2510 **** |
| * NOTE: Ignore right button down and drag mouse events. |
| * Windows only shows the popup menu on the button up event. |
| */ |
| ! #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) |
| if (!is_click) |
| return FALSE; |
| #endif |
| --- 2504,2511 ---- |
| * NOTE: Ignore right button down and drag mouse events. |
| * Windows only shows the popup menu on the button up event. |
| */ |
| ! #if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \ |
| ! || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) |
| if (!is_click) |
| return FALSE; |
| #endif |
| |
| |
| |
| *** 4783,4788 **** |
| --- 4783,4796 ---- |
| return -1; |
| current_menu = (vimmenu_T *)val; |
| slen += num_bytes; |
| + |
| + /* The menu may have been deleted right after it was used, check |
| + * for that. */ |
| + if (check_menu_pointer(root_menu, current_menu) == FAIL) |
| + { |
| + key_name[0] = KS_EXTRA; |
| + key_name[1] = (int)KE_IGNORE; |
| + } |
| } |
| # endif |
| # ifdef FEAT_GUI_TABLINE |
| |
| |
| |
| *** 668,669 **** |
| --- 668,671 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 62, |
| /**/ |
| |
| -- |
| hundred-and-one symptoms of being an internet addict: |
| 166. You have been on your computer soo long that you didn't realize |
| you had grandchildren. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ download, build and distribute -- http://www.A-A-P.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |