Tk Source Code

View Ticket
Login
Ticket UUID: 3348994
Title: Freeze for Dialogs Created from Shortcut
Type: Bug Version: obsolete: 8.6b1.1
Submitter: mleuschel Created on: 2011-07-01 13:42:11
Subsystem: 11. Aqua Menus Assigned To: wordtech
Priority: 7 High Severity:
Status: Closed Last Modified: 2026-10-22 17:22:36
Resolution: Out of Date Closed By: serhiy.storchaka
    Closed on: 2026-10-08 12:37:15
Description:
When creating a dialog box from a command key shortcut Tcl/Tk Aqua freezes up.
This issue appears in the latest Active Tcl/Tk version for Mac; I think it also happens in the latest 8.5.9.2 build available.

This is related to the bug "https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3285355&group_id=12997" (this bug appears when an error message has to be displayed, with very similar consequences: a freeze and a white rectangle on the screen where the dialog should be).

I have cut down the example as much as possible. It works flawlessly on other platforms and on Mac using Active Tcl 8.4 and the older 8.5 builds.

(Basically this issue means that currently there is *no* Active Tcl build for Mac that works with our application; almost every command-key shortcut causes Tcl/Tk to freeze.)
User Comments: serhiy.storchaka added on 2026-10-08 12:37:15:

The example was deleted, and the Cocoa event loop integration was fixed in [3028676] and reworked in 8.6.10. Also, since [33b3af1cea], menu actions, including those invoked by Command-key shortcuts, are run as idle tasks, so a dialog opened from them no longer runs inside AppKit's menu handling. Please open a new ticket if a current Tk still hangs.


wordtech added on 2012-09-27 22:02:27:

File Deleted - 417062:

wordtech added on 2011-07-07 21:43:35:
This appears to be related to bug 3028676, but as I note in that bug, it is a complicated issue that is beyond my skill set to address at this time. As a result, I think it makes sense to identify the events in the sample script that cause the freeze, in order to come up with a suitable workaround.  Currently I can't quite isolate what triggers the bug in this code sample. Simply using a keyboard shortcut to produce a toplevel does not produce any freeze, nor does adding grab, focus, and tkwait commands:  global click

set click {}

proc dlg {} {

global click

toplevel .f
grab -global .f

pack [button .f.b -text "Press me" -command {puts "clicked!"; set click 1}]

bind .f <Command-w> {destroy .f}

tkwait variable click

}


bind . <Command-D> dlg

If you can provide a more cut-down example that allows us to isolate where the bug occurs, then I can suggest a better workaround to avoid it.

mleuschel added on 2011-07-07 16:31:09:
Note: I did attach the file now.

mleuschel added on 2011-07-07 16:30:59:
Note: I did attach the file.

mleuschel added on 2011-07-05 11:38:51:

File Added - 417062: btracer_CmdKey_for_Mac_Crash_min.tcl

hobbs added on 2011-07-05 08:08:51:
There is no sample code provided here.  Note that this is not really an ActiveTcl issue - this is a core issue with the cocoa port.