diff options
author | dgp <dgp@noemail.net> | 2006-07-21 14:56:14 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2006-07-21 14:56:14 (GMT) |
commit | d2aeaae13c7e4ed84f7a8bc5f0e278583f0b36e3 (patch) | |
tree | ab3d1725761097a0ef5beadfebf4d2a008505e35 /generic | |
parent | 4fc19106a76be51b2be4c34b64723f046156d5e5 (diff) | |
download | tcl-d2aeaae13c7e4ed84f7a8bc5f0e278583f0b36e3.zip tcl-d2aeaae13c7e4ed84f7a8bc5f0e278583f0b36e3.tar.gz tcl-d2aeaae13c7e4ed84f7a8bc5f0e278583f0b36e3.tar.bz2 |
undo mistaken commit
FossilOrigin-Name: 4e1c9e6425b9115af8dc2c021c995a7dbdd2379b
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclInt.h | 15 | ||||
-rw-r--r-- | generic/tclObj.c | 22 |
2 files changed, 17 insertions, 20 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index cb4a70f..ecc7615 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.273 2006/07/21 10:47:19 msofer Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.274 2006/07/21 14:56:14 dgp Exp $ */ #ifndef _TCLINT @@ -2624,20 +2624,15 @@ MODULE_SCOPE void TclInvalidateNsPath(Namespace *nsPtr); (objPtr)->length = 0; \ (objPtr)->typePtr = NULL -/* Invalidate the string rep first so we can use the bytes value \ - * for our pointer chain, and signal an obj deletion (as opposed \ - * to shimmering) with 'length == -1' */ \ - # define TclDecrRefCount(objPtr) \ if (--(objPtr)->refCount <= 0) { \ - if ((objPtr)->bytes \ - && ((objPtr)->bytes != tclEmptyStringRep)) { \ - ckfree((char *) (objPtr)->bytes); \ - } \ - (objPtr)->length = -1; \ if ((objPtr)->typePtr && (objPtr)->typePtr->freeIntRepProc) { \ TclFreeObj(objPtr); \ } else { \ + if ((objPtr)->bytes \ + && ((objPtr)->bytes != tclEmptyStringRep)) { \ + ckfree((char *) (objPtr)->bytes); \ + } \ TclFreeObjStorage(objPtr); \ TclIncrObjsFreed(); \ } \ diff --git a/generic/tclObj.c b/generic/tclObj.c index 6463904..5d1fe8a 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.110 2006/07/21 10:47:19 msofer Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.111 2006/07/21 14:56:14 dgp Exp $ */ #include "tclInt.h" @@ -111,8 +111,13 @@ typedef struct PendingObjData { #define ObjDeletePending(contextPtr) ((contextPtr)->deletionCount > 0) #define ObjOnStack(contextPtr) ((contextPtr)->deletionStack != NULL) #define PushObjToDelete(contextPtr,objPtr) \ - /* The string rep is already invalidated so we can use the bytes value \ - * for our pointer chain: push onto the head of the stack. */ \ + /* Invalidate the string rep first so we can use the bytes value \ + * for our pointer chain. */ \ + if (((objPtr)->bytes != NULL) \ + && ((objPtr)->bytes != tclEmptyStringRep)) { \ + ckfree((char *) (objPtr)->bytes); \ + } \ + /* Now push onto the head of the stack. */ \ (objPtr)->bytes = (char *) ((contextPtr)->deletionStack); \ (contextPtr)->deletionStack = (objPtr) #define PopObjToDelete(contextPtr,objPtrVar) \ @@ -844,13 +849,6 @@ TclFreeObj( Tcl_Panic("Reference count for %lx was negative", objPtr); } - /* Invalidate the string rep first so we can use the bytes value - * for our pointer chain, and signal an obj deletion (as opposed - * to shimmering) with 'length == -1' */ - - TclInvalidateStringRep(objPtr); - objPtr->length = -1; - if (ObjDeletePending(context)) { PushObjToDelete(context, objPtr); } else { @@ -859,6 +857,7 @@ TclFreeObj( typePtr->freeIntRepProc(objPtr); ObjDeletionUnlock(context); } + TclInvalidateStringRep(objPtr); Tcl_MutexLock(&tclObjMutex); ckfree((char *) objPtr); @@ -924,6 +923,9 @@ TclFreeObj( objPtr->typePtr->freeIntRepProc(objPtr); ObjDeletionUnlock(context); + if (objPtr->bytes && (objPtr->bytes != tclEmptyStringRep)) { + ckfree((char *) objPtr->bytes); + } TclFreeObjStorage(objPtr); TclIncrObjsFreed(); ObjDeletionLock(context); |