diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2006-07-21 10:47:18 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2006-07-21 10:47:18 (GMT) |
commit | 7aa734510a8d4513721e66fa08ec27b72726d1a6 (patch) | |
tree | ebfd27f59af5c53eade7e31ae6b0414b8e9661e6 /generic/tclObj.c | |
parent | af031c0a09d0d4abeb4bf13bd542663126fb2245 (diff) | |
download | tcl-7aa734510a8d4513721e66fa08ec27b72726d1a6.zip tcl-7aa734510a8d4513721e66fa08ec27b72726d1a6.tar.gz tcl-7aa734510a8d4513721e66fa08ec27b72726d1a6.tar.bz2 |
* generic/tclExecute.c:
* tests/execute.test (execute-9.1): dgp's fix for [Bug 1522803].
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r-- | generic/tclObj.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index 521a49b..6463904 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.109 2006/07/20 06:17:39 das Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.110 2006/07/21 10:47:19 msofer Exp $ */ #include "tclInt.h" @@ -111,13 +111,8 @@ typedef struct PendingObjData { #define ObjDeletePending(contextPtr) ((contextPtr)->deletionCount > 0) #define ObjOnStack(contextPtr) ((contextPtr)->deletionStack != NULL) #define PushObjToDelete(contextPtr,objPtr) \ - /* 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. */ \ + /* The string rep is already invalidated so we can use the bytes value \ + * for our pointer chain: push onto the head of the stack. */ \ (objPtr)->bytes = (char *) ((contextPtr)->deletionStack); \ (contextPtr)->deletionStack = (objPtr) #define PopObjToDelete(contextPtr,objPtrVar) \ @@ -849,6 +844,13 @@ 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 { @@ -857,7 +859,6 @@ TclFreeObj( typePtr->freeIntRepProc(objPtr); ObjDeletionUnlock(context); } - TclInvalidateStringRep(objPtr); Tcl_MutexLock(&tclObjMutex); ckfree((char *) objPtr); @@ -923,9 +924,6 @@ TclFreeObj( objPtr->typePtr->freeIntRepProc(objPtr); ObjDeletionUnlock(context); - if (objPtr->bytes && (objPtr->bytes != tclEmptyStringRep)) { - ckfree((char *) objPtr->bytes); - } TclFreeObjStorage(objPtr); TclIncrObjsFreed(); ObjDeletionLock(context); |