Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a21f34102c9cf081c6630f261437f8b7b1358a8fcf083107187e8a02df062159
Ticket: 9471e6e3042c18f3c8403b7013ecdf104efb5b6d
InitWinEnv not thread safe
User & Date: christian.nassau on 2018-12-15 15:17:37
Changes

  1. icomment:
    Here is a fix; I have no idea where to submit this "officially". 
    
    Index: library/init.tcl
    ==================================================================
    --- library/init.tcl
    +++ library/init.tcl
    @@ -96,13 +96,17 @@
     		set u [string toupper $p]
     		if {$u ne $p} {
     		    switch -- $u {
     			COMSPEC -
     			PATH {
    -			    set temp $env($p)
    -			    unset env($p)
    -			    set env($u) $temp
    +			    # need to catch access to env since it is a volatile
    +			    # array that can be changed by another thread
    +			    # (ticket [9471e6e3042c18f3c8403b7013ecdf104efb5b6d])
    +			    if {![catch {set temp $env($p)}]} {
    +			        unset -nocomplain env($p)
    +			        set env($u) $temp
    +			    }
     			    trace add variable env($p) write \
     				    [namespace code [list EnvTraceProc $p]]
     			    trace add variable env($u) write \
     				    [namespace code [list EnvTraceProc $p]]
     			}
    
  2. login: "christian.nassau"
  3. mimetype: "text/plain"
  4. priority changed to: "6"