summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2007-09-08 23:36:55 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2007-09-08 23:36:55 (GMT)
commit14632a9fcf8e523ae2abf3c2b5c661721835998d (patch)
tree6d5d54ddff1ab926facf6e4702e8ccf0d6315146 /generic
parent9759bbcba71f400d022a28af45b8fa2a2fe26cc9 (diff)
downloadtcl-14632a9fcf8e523ae2abf3c2b5c661721835998d.zip
tcl-14632a9fcf8e523ae2abf3c2b5c661721835998d.tar.gz
tcl-14632a9fcf8e523ae2abf3c2b5c661721835998d.tar.bz2
* generic/tclVar.c (Tcl_SetVar2, TclPtrSetVar): [Bug 1710710]
fixed correctly, reverted fix of 2007-05-01.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclVar.c11
1 files changed, 4 insertions, 7 deletions
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) {