summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2004-08-16 14:11:15 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2004-08-16 14:11:15 (GMT)
commitd07ab28f62a08b419ff7177e90627bb1cabc0934 (patch)
tree1ad6d132ced7638ca7c489985047946ff4b86060 /generic/tclVar.c
parentd9ab72b3082ccef8f68082f7e05484e303a27d37 (diff)
downloadtcl-d07ab28f62a08b419ff7177e90627bb1cabc0934.zip
tcl-d07ab28f62a08b419ff7177e90627bb1cabc0934.tar.gz
tcl-d07ab28f62a08b419ff7177e90627bb1cabc0934.tar.bz2
fix for [Bug 1008314]
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r--generic/tclVar.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 4b69ce6..6c1a4e5 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.87 2004/07/23 18:32:06 msofer Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.88 2004/08/16 14:11:31 msofer Exp $
*/
#ifdef STDC_HEADERS
@@ -1566,7 +1566,7 @@ TclPtrSetVar(interp, varPtr, arrayPtr, part1, part2, newValuePtr, flags)
CONST char *part2; /* If non-NULL, gives the name of an element
* in the array part1. */
Tcl_Obj *newValuePtr; /* New value for variable. */
- CONST int flags; /* OR-ed combination of TCL_GLOBAL_ONLY,
+ CONST int flags; /* OR-ed combination of TCL_GLOBAL_ONLY,
* and TCL_LEAVE_ERR_MSG bits. */
{
Interp *iPtr = (Interp *) interp;
@@ -1625,8 +1625,11 @@ TclPtrSetVar(interp, varPtr, arrayPtr, part1, part2, newValuePtr, flags)
* "copy on write".
*/
+ if (flags & TCL_LIST_ELEMENT && !(flags & TCL_APPEND_VALUE)) {
+ TclSetVarUndefined(varPtr);
+ }
oldValuePtr = varPtr->value.objPtr;
- if (flags & TCL_APPEND_VALUE) {
+ if (flags & (TCL_APPEND_VALUE|TCL_LIST_ELEMENT)) {
if (TclIsVarUndefined(varPtr) && (oldValuePtr != NULL)) {
Tcl_DecrRefCount(oldValuePtr); /* discard old value */
varPtr->value.objPtr = NULL;