Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7a04d7c6e22dbb545f65ecee136308cac732322c1138bde856347a728ab97fc4
Ticket: 103abf181eb01366c018e047d525d0d042c8c5c5
regression since 9.0.4 brings leaks and hangs to bundled Itcl 4.3.8
User & Date: serhiy.storchaka on 2026-11-16 22:17:57
Changes

  1. icomment:
    The hang is caused by Itcl's leak-test harness. widgetadaptor.test and widgetclass.test set their <tt>tk</tt> constraint with <tt>package require Tk</tt> in the main interpreter before calling <tt>loadTestedCommands</tt>. In the leak-test mode, tests/helpers.tcl runs the file in child interpreters and stops the main one with <tt>return -code return</tt>, but the main interpreter's Tk main window stays. When the script ends, <tt>Tcl_Main</tt> enters the Tk event loop and waits forever. The old tcltest hid this by exiting from the child interpreter.
    
    This patch to Itcl destroys that window after the leak test:
    
    <verbatim>
    --- tests/helpers.tcl
    +++ tests/helpers.tcl
    @@ -42,7 +42,14 @@
         if {$leak} {
           puts "LEAKED: $leak bytes"
         }
       }
       itcl_leaktest [info script]
    +  # The test file may have loaded Tk in this interpreter (to set its tk
    +  # constraint) before calling loadTestedCommands. Destroy its main
    +  # window, or the application would wait in the Tk event loop when the
    +  # script ends.
    +  if {[info commands ::destroy] ne ""} {
    +    destroy .
    +  }
       return -code return
     }
    </verbatim>
    
    With it, all 2373 Itcl 4.3.8 tests pass with Tk available and nothing hangs. The leak check still reports 17149 bytes for widgetadaptor.test and 12880 bytes for widgetclass.test.
    
  2. login: "serhiy.storchaka"
  3. mimetype: "text/x-fossil-wiki"