diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2004-07-15 17:42:11 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2004-07-15 17:42:11 (GMT) |
commit | 904a467ccfeca1913883354a57a3639c84f403b1 (patch) | |
tree | c90cbe8bfbba40582d7d52caa3d333c26062927d /generic/tclCompile.c | |
parent | 4d636106758757629d87a6b8e9fa35cb684fbe93 (diff) | |
download | tcl-904a467ccfeca1913883354a57a3639c84f403b1.zip tcl-904a467ccfeca1913883354a57a3639c84f403b1.tar.gz tcl-904a467ccfeca1913883354a57a3639c84f403b1.tar.bz2 |
* generic/tclCompile.c (TclCompileScript):
* generic/tclLiteral.c (TclReleaseLiteral): fix for [Bug 467523],
which resurfaced with the latest changes. The previous strategy
was to have special code in TclReleaseLiteral to handle the
self-references generated by empty scripts. The new approach
avoids the self-reference altogether, by having empty scripts
return an unshared literal.
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r-- | generic/tclCompile.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 5376123..03b62ca 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.70 2004/07/08 18:46:05 msofer Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.71 2004/07/15 17:42:12 msofer Exp $ */ #include "tclInt.h" @@ -1208,11 +1208,16 @@ TclCompileScript(interp, script, numBytes, envPtr) /* * If the source script yielded no instructions (e.g., if it was empty), * push an empty string as the command's result. + * + * WARNING: push an unshared object! If the script being compiled is a + * shared empty string, it will otherwise be self-referential and cause + * difficulties with literal management [Bugs 467523, 983660]. We used to + * have special code in TclReleaseLiteral to handle this particular + * self-reference, but now opt for avoiding its creation altogether. */ if (envPtr->codeNext == entryCodeNext) { - TclEmitPush(TclRegisterLiteral(envPtr, "", 0, /*onHeap*/ 0), - envPtr); + TclEmitPush(TclAddLiteralObj(envPtr, Tcl_NewObj(), NULL), envPtr); } envPtr->numSrcBytes = (p - script); |