summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2021-05-15 19:04:09 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2021-05-15 19:04:09 (GMT)
commite7d3979e0a81af48f3e7bc932b5f674a344a736b (patch)
tree01d0e19ccccfa6c75d426c75ea81d1d1deeea565
parent71008a6aa81384792384cd9515d9f7a822c3341b (diff)
downloadtcl-e7d3979e0a81af48f3e7bc932b5f674a344a736b.zip
tcl-e7d3979e0a81af48f3e7bc932b5f674a344a736b.tar.gz
tcl-e7d3979e0a81af48f3e7bc932b5f674a344a736b.tar.bz2
Delete associated data after running Tcl_InterpDeleteProc instead of before. Remove redundant/cyclic call to Tcl_DeleteAssocData.
-rw-r--r--generic/tclBasic.c14
-rw-r--r--generic/tclTestObj.c1
2 files changed, 7 insertions, 8 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 5ca70d4..2d10812 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -1826,28 +1826,28 @@ DeleteInterpProc(
ckfree(hTablePtr);
}
- /*
- * Invoke deletion callbacks; note that a callback can create new
- * callbacks, so we iterate.
- */
- while (iPtr->assocData != NULL) {
+ if (iPtr->assocData != NULL) {
AssocData *dPtr;
hTablePtr = iPtr->assocData;
- iPtr->assocData = NULL;
+ /*
+ * Invoke deletion callbacks; note that a callback can create new
+ * callbacks, so we iterate.
+ */
for (hPtr = Tcl_FirstHashEntry(hTablePtr, &search);
hPtr != NULL;
hPtr = Tcl_FirstHashEntry(hTablePtr, &search)) {
dPtr = (AssocData *)Tcl_GetHashValue(hPtr);
- Tcl_DeleteHashEntry(hPtr);
if (dPtr->proc != NULL) {
dPtr->proc(dPtr->clientData, interp);
}
+ Tcl_DeleteHashEntry(hPtr);
ckfree(dPtr);
}
Tcl_DeleteHashTable(hTablePtr);
ckfree(hTablePtr);
+ iPtr->assocData = NULL;
}
/*
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index 17546a4..4e7cec9 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -61,7 +61,6 @@ static void VarPtrDeleteProc(void *clientData, Tcl_Interp *interp)
for (i = 0; i < NUMBER_OF_OBJECT_VARS; i++) {
if (varPtr[i]) Tcl_DecrRefCount(varPtr[i]);
}
- Tcl_DeleteAssocData(interp, VARPTR_KEY);
ckfree(varPtr);
}