| Ticket UUID: | a4c72a04e322de44cd61702accda889d36640fb | |||
| Title: | macOS Aqua : little error with menu-buttons demo | |||
| Type: | Bug | Version: | trunk | |
| Submitter: | nab | Created on: | 2021-12-17 10:31:04 | |
| Subsystem: | (unused) | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-10-22 17:04:12 | |
| Resolution: | Fixed | Closed By: | jan.nijtmans | |
| Closed on: | 2026-10-22 17:04:12 | |||
| Description: |
Hi Marc, when running menu-buttons demo, if you click on any menu button (except Below and Above...), menu is displayed. Then if you Cmd+W (while menu is displayed) an error is triggered. ++ | |||
| User Comments: |
jan.nijtmans added on 2026-10-22 17:04:12:
> I don't know which part of the TIP 765 implementation fixed this problem, > but it seems like another good reason to approve and merge that TIP. The problem with menu-46.1 is fixed in [4bbb759d|this] follow-up commit nemethi (claiming to be Csaba Nemethi) added on 2026-10-17 18:14:03: Merged by Jan into main and core-9-0-branch by commits [6037383f] and [0168135c]; backported to core-8-6-branch by commit [8cbb336f]. marc_culler (claiming to be Marc Culler) added on 2026-10-16 19:20:06: At least the error is gone. I still don't know what the correct behavior of Cmd+W should be when a menu is open. I guess it depends on whether you consider the menu to be the frontmost window or just a part of the frontmost window. However, Tk never receives any key events while a menu is open because AppKit is running a runloop with runloop mode NSEventTrackingRunLoopMode while the menu is open, and that runloop steals all mouse and key events. marc_culler (claiming to be Marc Culler) added on 2026-10-16 19:13:54: I just tested this with the tip_765 branch on M4 macOS 26. This problem seems to be fixed in that branch. For every menu in the menu-buttons demo, typing Cmd+W while the menu is displayed causes the window to close with no error. I don't know which part of the TIP 765 implementation fixed this problem, but it seems like another good reason to approve and merge that TIP. jan.nijtmans added on 2026-10-15 13:00:00: > Tested on X11 and Windows; not on macOS On macOS: ---- menu-46.1 start /bin/sh: line 1: 15406 Segmentation fault: 11 ./tktest /Users/runner/work/tk/tk/tk/unix/../tests/all.tcl -file menu.test -verbose t make: *** [test-classic] Error 139 Since this fix is Tcl-only, it shows that there's an additional problem on macOS. I don't see anything wrong with the branch. Therefore I temporarily added a "notAqua" constraint to this testcase, to be removed when the macOS segmentation fault is gone. Investigating ..... (but if anyone else has an idea, any help is appreciated!) It means, this ticket cannot be fully closed yet. serhiy.storchaka added on 2026-10-08 13:01:13: Whatever Cmd+W should do, the error is a bug: the menu can be destroyed while it is posted, during $menu post: on macOS while the native menu is shown, and on all platforms by the -postcommand. tk::PostOverPoint, tk::MbPost and tk_popup then used the destroyed menu. On X11 the same errors can be triggered with a -postcommand which destroys the toplevel. Proposed fix in branch menubutton-post-destroyed, with tests menubutton-14.1, 14.2 and menu-46.1 (they fail without the fix on X11). Tested on X11 and Windows; not on macOS. marc_culler (claiming to be Marc Culler) added on 2021-12-27 21:56:40: I can see the same results, and they are inconsistent. But there still is no example where Cmd+W closes a menu. nab added on 2021-12-19 17:10:18: I've tested with Apple's Preference app (it's in French so I'm not very sure of my translation) If you open 'Dock and Menu Bar', if you click on 'reduction type' combobox, menu is posted, hitting Cmd+W do nothing. If you open 'Mission Control', click on the first combobox to determine which shortcut is assigned to MissionControl, menu is posted, hitting Cmd+W close Apple's Preference app. so their behaviour is not very consistent. In any case I do think that the menu window should be closed :) ++ marc_culler (claiming to be Marc Culler) added on 2021-12-19 15:04:01: I tested with Apple's Preferences app. If a pop-down menu is open when you press Cmd-W nothing happens. The menu stays open and the window does not close. If you have a main menu open, say the Edit menu, then pressing Cmd-W closes the front window of the app and leaves the Edit menu open. I can't find any case where Cmd-W just closes a menu and leaves the front window open. nab added on 2021-12-17 14:50:53: for me, it should only close the posted menu (like if it was an Escape), it should not try to close the toplevel.
but that just me...
in case, here the error log:
invalid command name ".menubu.body.right.m"
invalid command name ".menubu.body.right.m"
while executing
"$menu entrycget $entry -state"
(procedure "PostOverPoint" line 4)
invoked from within
"PostOverPoint $menu $x $y $entry"
(procedure "PostMenubuttonMenu" line 30)
invoked from within
"PostMenubuttonMenu $w $menu"
(procedure "tk::MbPost" line 37)
invoked from within
"tk::MbPost $tk::Priv(inMenubutton) 323 486"
invoked from within
"if {$tk::Priv(inMenubutton) ne ""} {
tk::MbPost $tk::Priv(inMenubutton) 323 486
}"
(command bound to event)
++
marc_culler (claiming to be Marc Culler) added on 2021-12-17 14:39:59: What is the expected behavior when you press Cmd+W when a menu is displayed? Again, this sounds like a problem in the Tcl library. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki