diff options
author | hobbs <hobbs> | 2008-03-27 21:02:55 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2008-03-27 21:02:55 (GMT) |
commit | 0a9ab8614642f5e827de4edc85c71917069eebe2 (patch) | |
tree | 2c43b234c3dac0fd69c81b09ea3f8ac8d1a0b5f6 | |
parent | dc732074ee480def39f95fbeda7faa6b32a92d98 (diff) | |
download | tk-0a9ab8614642f5e827de4edc85c71917069eebe2.zip tk-0a9ab8614642f5e827de4edc85c71917069eebe2.tar.gz tk-0a9ab8614642f5e827de4edc85c71917069eebe2.tar.bz2 |
* library/safetk.tcl (::safe::tkInterpInit): make sure tk_library
and its subdirs (eg, ttk) are on the "safe" access path.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | library/safetk.tcl | 56 |
2 files changed, 30 insertions, 31 deletions
@@ -1,3 +1,8 @@ +2008-03-27 Jeff Hobbs <jeffh@ActiveState.com> + + * library/safetk.tcl (::safe::tkInterpInit): make sure tk_library + and its subdirs (eg, ttk) are on the "safe" access path. + 2008-03-27 Daniel Steffen <das@users.sourceforge.net> * unix/tcl.m4 (SunOS-5.1x): fix 64bit support for Sun cc. [Bug 1921166] diff --git a/library/safetk.tcl b/library/safetk.tcl index 4ad1418..c7cf97d 100644 --- a/library/safetk.tcl +++ b/library/safetk.tcl @@ -2,7 +2,7 @@ # # Support procs to use Tk in safe interpreters. # -# RCS: @(#) $Id: safetk.tcl,v 1.10 2006/11/03 15:58:51 patthoyts Exp $ +# RCS: @(#) $Id: safetk.tcl,v 1.11 2008/03/27 21:02:56 hobbs Exp $ # # Copyright (c) 1997 Sun Microsystems, Inc. # @@ -27,34 +27,30 @@ package require opt 0.4.1; namespace eval ::safe { # counter for safe toplevels - variable tkSafeId 0; - - # - # tkInterpInit : prepare the slave interpreter for tk loading - # most of the real job is done by loadTk - # returns the slave name (tkInterpInit does) - # - proc ::safe::tkInterpInit {slave argv} { - global env tk_library - - # We have to make sure that the tk_library variable uses a file - # pathname that works better in Tk (of the style returned by - # [file join], ie C:/path/to/tk/lib, not C:\path\to\tk\lib - set tk_library [file join $tk_library] - - # Clear Tk's access for that interp (path). - allowTk $slave $argv - - # there seems to be an obscure case where the tk_library - # variable value is changed to point to a sym link destination - # dir instead of the sym link itself, and thus where the $tk_library - # would then not be anymore one of the auto_path dir, so we use - # the addToAccessPath which adds if it's not already in instead - # of the more conventional findInAccessPath. - # Might be usefull for masters without Tk really loaded too. - ::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]] - return $slave + variable tkSafeId 0 +} + +# +# tkInterpInit : prepare the slave interpreter for tk loading +# most of the real job is done by loadTk +# returns the slave name (tkInterpInit does) +# +proc ::safe::tkInterpInit {slave argv} { + global env tk_library + + # We have to make sure that the tk_library variable is normalized. + set tk_library [file normalize $tk_library] + + # Clear Tk's access for that interp (path). + allowTk $slave $argv + + # Ensure tk_library and subdirs (eg, ttk) are on the access path + ::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]] + foreach subdir [::safe::AddSubDirs [list $tk_library]] { + ::safe::interpAddToAccessPath $slave $subdir } + return $slave +} # tkInterpLoadTk : @@ -67,7 +63,7 @@ namespace eval ::safe { # empty definition for auto_mkIndex proc ::safe::loadTk {} {} -::tcl::OptProc loadTk { +::tcl::OptProc ::safe::loadTk { {slave -interp "name of the slave interpreter"} {-use -windowId {} "window Id to use (new toplevel otherwise)"} {-display -displayName {} "display name to use (current one otherwise)"} @@ -275,5 +271,3 @@ proc ::safe::tkTopLevel {slave display} { # return both the toplevel window name and the id to use for embedding list $w [winfo id $w.c] } - -}
\ No newline at end of file |