summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-06-10 23:34:45 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-06-10 23:34:45 (GMT)
commitac5377745066c2cc9fdc1d30ff2d449e2bb5b6d4 (patch)
tree0c318edc6eab5cd48c53db490c984ca7cab606ac /generic
parentf3f5448b0aa89dfc3c913d3f2e43e34e1c0c106c (diff)
downloadtcl-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')
-rw-r--r--generic/tclBasic.c10
-rw-r--r--generic/tclProc.c22
2 files changed, 19 insertions, 13 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 1d289f2..fa13b50 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -1390,11 +1390,13 @@ DeleteInterpProc(
CmdFrame *cfPtr = Tcl_GetHashValue(hPtr);
Proc *procPtr = (Proc *) Tcl_GetHashKey(iPtr->linePBodyPtr, hPtr);
procPtr->iPtr = NULL;
- if (cfPtr->type == TCL_LOCATION_SOURCE) {
- Tcl_DecrRefCount(cfPtr->data.eval.path);
+ if (cfPtr) {
+ if (cfPtr->type == TCL_LOCATION_SOURCE) {
+ Tcl_DecrRefCount(cfPtr->data.eval.path);
+ }
+ ckfree((char *) cfPtr->line);
+ ckfree((char *) cfPtr);
}
- ckfree((char *) cfPtr->line);
- ckfree((char *) cfPtr);
Tcl_DeleteHashEntry(hPtr);
}
Tcl_DeleteHashTable(iPtr->linePBodyPtr);
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));
/*