Tk Source Code

View Ticket
Login
2026-10-08
13:08 • Ticket [c0662eca] On aqua, the after callbacks are delayed until releasing the mouse button status still Open with 3 other changes artifact: 08f2adc8 user: serhiy.storchaka
13:06 • Ticket [3ceb6b0f] Aqua: timer events stop working during tk_messageBox status still Open with 3 other changes artifact: 028b3955 user: serhiy.storchaka
2023-03-28
07:26 • Ticket [3ceb6b0f]: 3 changes artifact: b78d2e1c user: chrstphrchvz
2022-05-01
15:07 • Ticket [3ceb6b0f]: 3 changes artifact: 0b235a3f user: kevin_walzer
11:40 • New ticket [3ceb6b0f]. artifact: dd17be10 user: chrstphrchvz

Ticket UUID: 3ceb6b0f65b26743808ed358ae7ff62b9232e09b
Title: Aqua: timer events stop working during tk_messageBox
Type: Bug Version: 8.6.12
Submitter: chrstphrchvz Created on: 2022-05-01 11:40:36
Subsystem: 38. [tk_messageBox] Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-10-08 13:06:49
Resolution: None Closed By: nobody
    Closed on:
Description:

Prompted by https://github.com/chrstphrchvz/perl-tcl-ptk/issues/25. For Tk on other platforms, and even previous Tk Aqua releases, timer events continue to run during tk_messageBox. Example:

proc p {} {puts [after 1000 p]}
p
tk_messageBox

will keep outputting after#… every second even if the message box hasn’t been dismissed yet. This is no longer the case for Tk Aqua at least since 8.6.12 (not aware exactly when).

If this limitation is unavoidable on Aqua, then it probably should be documented.

User Comments: serhiy.storchaka added on 2026-10-08 13:06:49:

This is still the case: Tcl's macOS notifier no longer services Tcl events in nested run loops since the 8.6.11 rework, so nothing runs during NSModalPanelRunLoopMode. For menus, Tk already keeps Tk events running during NSEventTrackingRunLoopMode with TKBackgroundLoop. Marc, would it make sense to use the same for NSModalPanelRunLoopMode while a dialog is open? That would make timers work during dialogs as on other platforms and as during menus.


chrstphrchvz added on 2023-03-28 07:26:56:

Daniel Steffen’s comment dated 2010-11-03 00:01:16 on https://core.tcl-lang.org/tk/tktview/3028676 indicates the opposite: that failing to handle Tcl events during modal dialogs and sheets is a regression.

Without fully bisecting, I believe the behavior changed in Tcl 8.6.11 as part of the macOS_hangs branch (https://core.tcl-lang.org/tcl/tktview?name=a58737f57b, https://core.tcl-lang.org/tcl/info/7495bd2a4429, https://core.tcl-lang.org/tcl/info/ca8b8183b62d), since the now-deleted call to Tcl_ServiceAll() from UpdateWaitingListAndServiceEvents() is where the timer event was previously being handled from.


kevin_walzer added on 2022-05-01 15:07:00:
Under Aqua, tk_messageBox is a native modal dialog. Pausing timer events should be the expected behavior because modal dialogs are supposed to prevent program execution until they are clicked.  If the events do not pause, wouldn't that be considered a bug?