summaryrefslogtreecommitdiffstats
path: root/generic/tkMenu.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-01-05 09:44:53 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-01-05 09:44:53 (GMT)
commit02b87f7d0041b6568f9b59a7a1e0399887027a8e (patch)
tree6614253727e7042fe22d834df061463060456259 /generic/tkMenu.c
parent78a5e8b596583e5334feb21d14214d909ab6343b (diff)
downloadtk-02b87f7d0041b6568f9b59a7a1e0399887027a8e.zip
tk-02b87f7d0041b6568f9b59a7a1e0399887027a8e.tar.gz
tk-02b87f7d0041b6568f9b59a7a1e0399887027a8e.tar.bz2
[Bug 220950]: Don't delete the last menu entry when it is obvious that is not
what was intended.
Diffstat (limited to 'generic/tkMenu.c')
-rw-r--r--generic/tkMenu.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 98f3f60..7af304e 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMenu.c,v 1.41.2.3 2009/12/30 00:29:38 patthoyts Exp $
+ * RCS: @(#) $Id: tkMenu.c,v 1.41.2.4 2010/01/05 09:44:54 dkf Exp $
*/
/*
@@ -777,7 +777,18 @@ MenuWidgetObjCmd(
Tcl_WrongNumArgs(interp, 2, objv, "first ?last?");
goto error;
}
- if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &first) != TCL_OK) {
+
+ /*
+ * If 'first' explicitly refers to past the end of the menu, we don't
+ * do anything. [Bug 220950]
+ */
+
+ if (isdigit(UCHAR(Tcl_GetString(objv[2])[0]))
+ && Tcl_GetIntFromObj(NULL, objv[2], &first) == TCL_OK) {
+ if (first >= menuPtr->numEntries) {
+ goto done;
+ }
+ } else if (TkGetMenuIndex(interp,menuPtr,objv[2],0,&first) != TCL_OK){
goto error;
}
if (objc == 3) {