diff options
author | dgp <dgp@users.sourceforge.net> | 2012-06-10 23:34:45 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-06-10 23:34:45 (GMT) |
commit | ac5377745066c2cc9fdc1d30ff2d449e2bb5b6d4 (patch) | |
tree | 0c318edc6eab5cd48c53db490c984ca7cab606ac /generic/tclProc.c | |
parent | f3f5448b0aa89dfc3c913d3f2e43e34e1c0c106c (diff) | |
download | tcl-ac5377745066c2cc9fdc1d30ff2d449e2bb5b6d4.zip tcl-ac5377745066c2cc9fdc1d30ff2d449e2bb5b6d4.tar.gz tcl-ac5377745066c2cc9fdc1d30ff2d449e2bb5b6d4.tar.bz2 |
3532959 Arrange for every lambda to place an entry in the linePBodyPtr hash table.
Then the two teardowns of data in that table synchronize so that the first to run
signals the other not to operate. Test proc-7.4 in a mem debug build of Tcl will
detect Bug 3532959 by crashing.
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r-- | generic/tclProc.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c index 325506b..7a93dbf 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -2198,7 +2198,7 @@ TclProcCleanupProc( * the same ProcPtr is overwritten with a new CmdFrame. */ - if (iPtr == NULL || iPtr->linePBodyPtr == NULL) { + if (iPtr == NULL) { return; } @@ -2209,13 +2209,15 @@ TclProcCleanupProc( cfPtr = (CmdFrame *) Tcl_GetHashValue(hePtr); - if (cfPtr->type == TCL_LOCATION_SOURCE) { - Tcl_DecrRefCount(cfPtr->data.eval.path); - cfPtr->data.eval.path = NULL; + if (cfPtr) { + if (cfPtr->type == TCL_LOCATION_SOURCE) { + Tcl_DecrRefCount(cfPtr->data.eval.path); + cfPtr->data.eval.path = NULL; + } + ckfree((char *) cfPtr->line); + cfPtr->line = NULL; + ckfree((char *) cfPtr); } - ckfree((char *) cfPtr->line); - cfPtr->line = NULL; - ckfree((char *) cfPtr); Tcl_DeleteHashEntry(hePtr); } @@ -2447,7 +2449,7 @@ SetLambdaFromAny( Interp *iPtr = (Interp *) interp; char *name; Tcl_Obj *argsPtr, *bodyPtr, *nsObjPtr, **objv, *errPtr; - int objc, result; + int isNew, objc, result; Proc *procPtr; if (interp == NULL) { @@ -2512,6 +2514,8 @@ SetLambdaFromAny( * common elements into a single function. */ + Tcl_SetHashValue(Tcl_CreateHashEntry(iPtr->linePBodyPtr, (char *) procPtr, + &isNew), NULL); if (iPtr->cmdFramePtr) { CmdFrame *contextPtr; @@ -2544,7 +2548,7 @@ SetLambdaFromAny( if (contextPtr->line && (contextPtr->nline >= 2) && (contextPtr->line[1] >= 0)) { - int isNew, buf[2]; + int buf[2]; CmdFrame *cfPtr = (CmdFrame *) ckalloc(sizeof(CmdFrame)); /* |