Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f755148d51a7e16ab663f93291bfafa8c2904c657eedf7cd6d8ed69e1b013bb7
Ticket: 0221b993a19fd8d1b72db4e79286c0861e7eb83c
Tcl command [update idletasks] doesn't skip main loop in Tcl_DoOneEvent
User & Date: erikleunissen on 2021-03-16 18:15:36
Changes

  1. icomment:
    Corroborating the misbehaviour:
    
    I've put a printf() inside the crucial code snippet in Tcl_DoOneEvent(), like:
    
    	if ((flags & TCL_ALL_EVENTS) == TCL_IDLE_EVENTS) {
    	    printf("***\n");
    	    flags = TCL_IDLE_EVENTS | TCL_DONT_WAIT;
    	    goto idleEvents;
    	}
    
    This printf() is skipped by [update idletasks] in a tclsh, but after loading Tk (which has a different implementation of the "update" command), the printf() statement is executed.
    
    This confirms my suspicion, that [update idletasks], called from tclsh (no Tk loaded) doesn't skip what it should skip inside Tcl_DoOneEVent(). The consequences are probably not as severe as that it services timer and file events, but it does carry out a bunch of useless work (harmful work not excluded), like checking inappropriate event sources.
    
    The remedy is simple (stripping the offending TCL_WINDOW_EVENTS inside Tcl_UpdateObjCmd() ). A patch (against tcl8.6.11) is provided anyway to prevent any ambiguity.
    
  2. login: "erikleunissen"
  3. mimetype: "text/plain"