summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-09-09 12:36:53 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-09-09 12:36:53 (GMT)
commitf26a4a0948cbd769519cf1e79ea027511051b2bd (patch)
treef3750a34d8a69cf76d5ef736777ae38310016f94 /generic/tclNamesp.c
parent768ec09104da815f43907bc6c3f829d03d4d4fc9 (diff)
downloadtcl-f26a4a0948cbd769519cf1e79ea027511051b2bd.zip
tcl-f26a4a0948cbd769519cf1e79ea027511051b2bd.tar.gz
tcl-f26a4a0948cbd769519cf1e79ea027511051b2bd.tar.bz2
Revert b98ee56376. The "bug" fixed was documented behavior.
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 74dfaf8..7f6ecf5 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -382,6 +382,19 @@ Tcl_PopCallFrame(
register CallFrame *framePtr = iPtr->framePtr;
Namespace *nsPtr;
+ /*
+ * It's important to remove the call frame from the interpreter's stack of
+ * call frames before deleting local variables, so that traces invoked by
+ * the variable deletion don't see the partially-deleted frame.
+ */
+
+ if (framePtr->callerPtr) {
+ iPtr->framePtr = framePtr->callerPtr;
+ iPtr->varFramePtr = framePtr->callerVarPtr;
+ } else {
+ /* Tcl_PopCallFrame: trying to pop rootCallFrame! */
+ }
+
if (framePtr->varTablePtr != NULL) {
TclDeleteVars(iPtr, framePtr->varTablePtr);
ckfree(framePtr->varTablePtr);
@@ -409,13 +422,6 @@ Tcl_PopCallFrame(
}
framePtr->nsPtr = NULL;
- if (framePtr->callerPtr) {
- iPtr->framePtr = framePtr->callerPtr;
- iPtr->varFramePtr = framePtr->callerVarPtr;
- } else {
- /* Tcl_PopCallFrame: trying to pop rootCallFrame! */
- }
-
if (framePtr->tailcallPtr) {
TclSetTailcall(interp, framePtr->tailcallPtr);
}