summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2004-08-16 14:18:24 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2004-08-16 14:18:24 (GMT)
commit01cbca5fa6ee5902771eac3ed96089dfe4205c06 (patch)
treee499ed436b4b92db213ed5e5405a8db7b68a60b2 /generic/tclVar.c
parent2a53d56ca0e99bc86f3261af330c316473eeced9 (diff)
downloadtcl-01cbca5fa6ee5902771eac3ed96089dfe4205c06.zip
tcl-01cbca5fa6ee5902771eac3ed96089dfe4205c06.tar.gz
tcl-01cbca5fa6ee5902771eac3ed96089dfe4205c06.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 e6bff11..8478394 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.69.2.5 2004/05/22 17:01:39 msofer Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.69.2.6 2004/08/16 14:18:26 msofer Exp $
*/
#include "tclInt.h"
@@ -1562,7 +1562,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;
@@ -1621,8 +1621,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;