Tk Source Code

View Ticket
Login
Ticket UUID: a418aafa7607a58682a19024d14b54d726e8b308
Title: Bogus @x,y indices are accepted for menu entries
Type: Bug Version: core-8-6-branch
Submitter: fvogel Created on: 2023-05-28 17:42:09
Subsystem: 10. Generic Menus Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2023-06-07 19:11:17
Resolution: Fixed Closed By: fvogel
    Closed on: 2023-06-07 19:11:17
Description:

Bogus @x,y indices are accepted for menu entries, e.g. @4sdfsdf or @4,1sqdf.

Moreover this bug triggers results that do not match the manual regarding the precedence order with which indices are interpreted as menu entries.

package require Tk
menu .m -tearoff 0
.m add command -label "First entry"
.m add command -label "@42nd street"
.m add command -label "Last entry"
.m index @4bogus         ; # silently interpreted as @4, wrongly returns 0, should error out
.m index @10,4bogus      ; # silently interpreted as @10,4, wrongly returns 0, should error out
.m index "@42nd*"        ; # silently interpreted as @42 while it should be interpreted as a pattern, wrongly returns 2, should return 1

User Comments: fvogel added on 2023-06-07 19:11:17:

Merged in core-8-6-branch and trunk. Note that for trunk [2507adcf] was needed to prevent a crash when running the test suite.


fvogel added on 2023-05-28 17:46:21:

New testcases demonstrating the problem committed in [6cd8664b].

Fix is [b2e64200].