diff options
author | dgp <dgp@users.sourceforge.net> | 2007-03-12 20:45:26 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-03-12 20:45:26 (GMT) |
commit | a515e66f386d98551f2ec1185ab2d6a925b03b5f (patch) | |
tree | 4b7cb67b16150414d6d59dc83ba0e72bcb4f525b /generic/tclExecute.c | |
parent | eff94c7a58c193ba8ea8e4b527d89bd7f9a404aa (diff) | |
download | tcl-a515e66f386d98551f2ec1185ab2d6a925b03b5f.zip tcl-a515e66f386d98551f2ec1185ab2d6a925b03b5f.tar.gz tcl-a515e66f386d98551f2ec1185ab2d6a925b03b5f.tar.bz2 |
* generic/tclExecute.c (INST_FOREACH_STEP4): Make private copy
* tests/foreach.test (foreach-10.1): of value list to be assigned
to variables so that shimmering of that list doesn't lead to invalid
pointers. [Bug 1671087]
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index c64f171..6c39e01 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.260 2007/03/02 10:32:12 dkf Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.261 2007/03/12 20:45:27 dgp Exp $ */ #include "tclInt.h" @@ -5305,8 +5305,8 @@ TclExecuteByteCode( numVars = varListPtr->numVars; listVarPtr = &(compiledLocals[listTmpIndex]); - listPtr = listVarPtr->value.objPtr; - Tcl_ListObjGetElements(interp, listPtr, &listLen, &elements); + listPtr = TclListObjCopy(NULL, listVarPtr->value.objPtr); + Tcl_ListObjGetElements(NULL, listPtr, &listLen, &elements); valIndex = (iterNum * numVars); for (j = 0; j < numVars; j++) { @@ -5343,11 +5343,13 @@ TclExecuteByteCode( TRACE_WITH_OBJ(("%u => ERROR init. index temp %d: ", opnd, varIndex), Tcl_GetObjResult(interp)); result = TCL_ERROR; + Tcl_DecrRefCount(listPtr); goto checkForCatch; } } valIndex++; } + Tcl_DecrRefCount(listPtr); listTmpIndex++; } } |