diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclVar.c | 11 |
2 files changed, 9 insertions, 7 deletions
@@ -1,3 +1,8 @@ +2007-09-08 Miguel Sofer <msofer@users.sf.net> + + * generic/tclVar.c (Tcl_SetVar2, TclPtrSetVar): [Bug 1710710] + fixed correctly, reverted fix of 2007-05-01. + 2007-09-08 Donal K. Fellows <dkf@users.sf.net> * generic/tclDictObj.c (DictUpdateCmd, DictWithCmd): Plug a hole that diff --git a/generic/tclVar.c b/generic/tclVar.c index 103690d..5b1a580 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -16,7 +16,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.151 2007/09/03 01:36:24 das Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.152 2007/09/08 23:36:55 msofer Exp $ */ #include "tclInt.h" @@ -1550,7 +1550,9 @@ Tcl_SetVar2( */ valuePtr = Tcl_NewStringObj(newValue, -1); + Tcl_IncrRefCount(valuePtr); varValuePtr = Tcl_SetVar2Ex(interp, part1, part2, valuePtr, flags); + Tcl_DecrRefCount(valuePtr); if (varValuePtr == NULL) { return NULL; @@ -1828,9 +1830,7 @@ TclPtrSetVar( } } else { /* Append string. */ /* - * We append newValuePtr's bytes but don't change its ref count if - * non-zero; if newValuePtr has a zero refCount and we are not - * using the obj, be sure to free it to avoid a leak. + * We append newValuePtr's bytes but don't change its ref count. */ if (oldValuePtr == NULL) { @@ -1844,9 +1844,6 @@ TclPtrSetVar( Tcl_IncrRefCount(oldValuePtr); /* Since var is ref. */ } Tcl_AppendObjToObj(oldValuePtr, newValuePtr); - if (newValuePtr->refCount == 0) { - Tcl_DecrRefCount(newValuePtr); - } } } } else if (newValuePtr != oldValuePtr) { |