diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-01-05 09:40:46 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-01-05 09:40:46 (GMT) |
commit | 9e471eb7e462d3f7acd8bb020b94999ae4ecff05 (patch) | |
tree | 94ed6c2ecb704bc3dd700c64e0531135a69e7aa4 /generic | |
parent | aacf8d739e27f7131d0a7322da993ba8158df5e6 (diff) | |
download | tk-9e471eb7e462d3f7acd8bb020b94999ae4ecff05.zip tk-9e471eb7e462d3f7acd8bb020b94999ae4ecff05.tar.gz tk-9e471eb7e462d3f7acd8bb020b94999ae4ecff05.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')
-rw-r--r-- | generic/tkMenu.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 4c0cd41..4f97eb9 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.55 2010/01/02 22:52:38 dkf Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.56 2010/01/05 09:40:46 dkf Exp $ */ /* @@ -778,7 +778,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) { |