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)
commitb0fd12960e73a75f19054c952e0f96b76f9034ca (patch)
treee499ed436b4b92db213ed5e5405a8db7b68a60b2 /generic/tclVar.c
parentfcdb3fb3304b33b2a76e2e47d92cdd5c2ca4c145 (diff)
downloadtcl-b0fd12960e73a75f19054c952e0f96b76f9034ca.zip
tcl-b0fd12960e73a75f19054c952e0f96b76f9034ca.tar.gz
tcl-b0fd12960e73a75f19054c952e0f96b76f9034ca.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;