summaryrefslogtreecommitdiffstats
path: root/generic/tclLiteral.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2004-07-05 22:40:58 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2004-07-05 22:40:58 (GMT)
commitfa306be9d7adf64d777414f45a59dd7b332b90ac (patch)
treef3a58df5284412aa94acfbf00c2e5ee72de51503 /generic/tclLiteral.c
parent40431793ba19022873eb80b047ac6c72e52e98c8 (diff)
downloadtcl-fa306be9d7adf64d777414f45a59dd7b332b90ac.zip
tcl-fa306be9d7adf64d777414f45a59dd7b332b90ac.tar.gz
tcl-fa306be9d7adf64d777414f45a59dd7b332b90ac.tar.bz2
* generic/tclBasic.c (DeleteInterpProc): fix for [Bug 983660],
found by pspjuth. Tear down the global namespace before freeing the interp handle, to allow the bytecodes to free their non-shared literals. * generic/tclLiteral.c (TclReleaseLiteral): moved special code for self-ref so that it is also used for non-shared literals. Possible bug found by inspection.
Diffstat (limited to 'generic/tclLiteral.c')
-rw-r--r--generic/tclLiteral.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index 9250413..2dfe37f 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLiteral.c,v 1.14 2004/04/06 22:25:54 dgp Exp $
+ * RCS: @(#) $Id: tclLiteral.c,v 1.15 2004/07/05 22:41:02 msofer Exp $
*/
#include "tclInt.h"
@@ -712,22 +712,6 @@ TclReleaseLiteral(interp, objPtr)
TclDecrRefCount(objPtr);
- /*
- * Check if the LiteralEntry is only being kept alive by
- * a circular reference from a ByteCode stored as its
- * internal rep. In that case, set the ByteCode object array
- * entry NULL to signal to TclCleanupByteCode to not try to
- * release this about to be freed literal again.
- */
-
- if (objPtr->typePtr == &tclByteCodeType) {
- codePtr = (ByteCode *) objPtr->internalRep.otherValuePtr;
- if ((codePtr->numLitObjects == 1)
- && (codePtr->objArrayPtr[0] == objPtr)) {
- codePtr->objArrayPtr[0] = NULL;
- }
- }
-
#ifdef TCL_COMPILE_STATS
iPtr->stats.currentLitStringBytes -= (double) (length + 1);
#endif /*TCL_COMPILE_STATS*/
@@ -735,6 +719,22 @@ TclReleaseLiteral(interp, objPtr)
break;
}
}
+
+ /*
+ * Check if the LiteralEntry is only being kept alive by
+ * a circular reference from a ByteCode stored as its
+ * internal rep. In that case, set the ByteCode object array
+ * entry NULL to signal to TclCleanupByteCode to not try to
+ * release this about to be freed literal again.
+ */
+
+ if (objPtr->typePtr == &tclByteCodeType) {
+ codePtr = (ByteCode *) objPtr->internalRep.otherValuePtr;
+ if ((codePtr->numLitObjects == 1)
+ && (codePtr->objArrayPtr[0] == objPtr)) {
+ codePtr->objArrayPtr[0] = NULL;
+ }
+ }
/*
* Remove the reference corresponding to the local literal table