Tk Source Code

View Ticket
Login
Ticket UUID: 1842c9eb6771baddcd912c948a227b669f17c5b9
Title: ttk auto-repeat goes on endlessly if the command raises an error or opens a modal dialog
Type: Bug Version: 9.1
Submitter: serhiy.storchaka Created on: 2026-11-21 09:42:06
Subsystem: 88. Themed Tk Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-11-23 13:45:00
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-11-23 13:45:00
Description:

When a ttk widget repeats an action while a mouse button is held (the arrows of ttk::spinbox and ttk::scrollbar, the trough of ttk::scale), the repeat goes on endlessly if the command opens a modal dialog, for example the background error dialog when the command raises an error:

ttk::spinbox .sb -from 0 -to 10000 -command {error boom}
pack .sb

Click an arrow of the spinbox: the error dialog is shown again and again, until the application is killed. The dialog takes the grab, so the button release goes to the dialog, and ttk::CancelRepeat is never called.

This was reported in tklib as tklib ticket cd399b24db. The case of a command waiting in tkwait from the same report was fixed in [fb9a363237]. The same problem in the classic scale was [99bb36df86].

Proposed fix in branch ttk-repeat-stop-on-grab: stop repeating if another window has the grab than when the repeat started, as for the classic scale in [c8f931cb9c].

User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-11-23 13:45:00:

Serhiy, many thanks! Merged into main, core-9-0-branch, and core-8-6-branch by commits [793d709a], [2c16988b], and [3148da5a].