summaryrefslogtreecommitdiffstats
path: root/library/safe.tcl
diff options
context:
space:
mode:
authorkjnash <k.j.nash@usa.net>2020-07-15 13:22:54 (GMT)
committerkjnash <k.j.nash@usa.net>2020-07-15 13:22:54 (GMT)
commitc14dbae8ad115c63cccc32ca0fee7a5c355edbe5 (patch)
treec339ed81812ad8458624fd52b163650692ba8c45 /library/safe.tcl
parent4e075914020910e813b93f97a4722145382908bc (diff)
downloadtcl-c14dbae8ad115c63cccc32ca0fee7a5c355edbe5.zip
tcl-c14dbae8ad115c63cccc32ca0fee7a5c355edbe5.tar.gz
tcl-c14dbae8ad115c63cccc32ca0fee7a5c355edbe5.tar.bz2
Bugfix in library/safe.tcl - when deleting a safe interpreter, delete its sub-interpreters cleanly; pass revised test safe-7.3
Diffstat (limited to 'library/safe.tcl')
-rw-r--r--library/safe.tcl11
1 files changed, 11 insertions, 0 deletions
diff --git a/library/safe.tcl b/library/safe.tcl
index 30b045e..68d4b21 100644
--- a/library/safe.tcl
+++ b/library/safe.tcl
@@ -593,6 +593,17 @@ proc ::safe::interpDelete {slave} {
namespace upvar ::safe S$slave state
+ # When an interpreter is deleted with [interp delete], any sub-interpreters
+ # are deleted automatically, but this leaves behind their data in the Safe
+ # Base. To clean up properly, we call safe::interpDelete recursively on each
+ # Safe Base sub-interpreter, so each one is deleted cleanly and not by
+ # the automatic mechanism built into [interp delete].
+ foreach sub [interp slaves $slave] {
+ if {[info exists ::safe::S[list $slave $sub]]} {
+ ::safe::interpDelete [list $slave $sub]
+ }
+ }
+
# If the slave has a cleanup hook registered, call it. Check the
# existance because we might be called to delete an interp which has
# not been registered with us at all