diff options
author | gahr <gahr@gahr.ch> | 2016-03-03 08:34:56 (GMT) |
---|---|---|
committer | gahr <gahr@gahr.ch> | 2016-03-03 08:34:56 (GMT) |
commit | 4b301d844892c52ec5fecce47f03c91a551639ca (patch) | |
tree | 7e5e124503a4afc925b79b149f6f07805d191b61 /generic/tclVar.c | |
parent | 46cb341dbc07abb1df54318ad9d55c41a5a68668 (diff) | |
parent | 8815f9f3c32c06e9f2d1d2b8ea69e1810988c5a4 (diff) | |
download | tcl-4b301d844892c52ec5fecce47f03c91a551639ca.zip tcl-4b301d844892c52ec5fecce47f03c91a551639ca.tar.gz tcl-4b301d844892c52ec5fecce47f03c91a551639ca.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r-- | generic/tclVar.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c index 451ef7b..5574f30 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -697,13 +697,16 @@ TclObjLookupVarEx( /* * An indexed local variable. */ + Tcl_Obj *cachedNamePtr = localName(iPtr->varFramePtr, index); part1Ptr->typePtr = &localVarNameType; - if (part1Ptr != localName(iPtr->varFramePtr, index)) { - part1Ptr->internalRep.twoPtrValue.ptr1 = - localName(iPtr->varFramePtr, index); - Tcl_IncrRefCount((Tcl_Obj *) - part1Ptr->internalRep.twoPtrValue.ptr1); + if (part1Ptr != cachedNamePtr) { + part1Ptr->internalRep.twoPtrValue.ptr1 = cachedNamePtr; + Tcl_IncrRefCount(cachedNamePtr); + if (cachedNamePtr->typePtr != &localVarNameType + || cachedNamePtr->internalRep.twoPtrValue.ptr1 != NULL) { + TclFreeIntRep(cachedNamePtr); + } } else { part1Ptr->internalRep.twoPtrValue.ptr1 = NULL; } |