summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-08-16 19:41:08 +0000
committerBram Moolenaar <Bram@vim.org>2006-08-16 19:41:08 +0000
commit968bbbe436ce87903ae22084635aa18004967da1 (patch)
treed7322482074062119d398beff61fcebe942ee2f3
parentf83c5c0113cdfbdc176dcdf65baca77f436ed54f (diff)
downloadvim-git-968bbbe436ce87903ae22084635aa18004967da1.tar.gz
updated for version 7.0-062v7.0.062
-rw-r--r--src/menu.c21
-rw-r--r--src/normal.c3
-rw-r--r--src/proto/menu.pro1
-rw-r--r--src/term.c8
-rw-r--r--src/version.c2
5 files changed, 34 insertions, 1 deletions
diff --git a/src/menu.c b/src/menu.c
index 80ada2c8e..926f4c124 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1778,6 +1778,27 @@ get_menu_mode()
}
/*
+ * 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
diff --git a/src/normal.c b/src/normal.c
index db6c66a59..df1afce21 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -2504,7 +2504,8 @@ do_mouse(oap, c, dir, count, fixindent)
* 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 defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \
+ || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
if (!is_click)
return FALSE;
#endif
diff --git a/src/proto/menu.pro b/src/proto/menu.pro
index 227b694d5..32a166531 100644
--- a/src/proto/menu.pro
+++ b/src/proto/menu.pro
@@ -10,6 +10,7 @@ extern int menu_is_popup __ARGS((char_u *name));
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));
diff --git a/src/term.c b/src/term.c
index 7597c93bd..9fcce2b6a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4783,6 +4783,14 @@ check_termcode(max_offset, buf, buflen)
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
diff --git a/src/version.c b/src/version.c
index 7ed4e4b23..7e0b557c7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 62,
+/**/
61,
/**/
60,