summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-08-13 12:42:38 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-08-13 12:42:38 (GMT)
commit3c1b7f78dc3d31142226b8c29cce38d5d3a86f03 (patch)
tree52d0ca4489845303b074fc697d13f83df4e2d29d
parentc903f10ac62ec93774a9785e5a29e06259882e1a (diff)
downloadtcl-3c1b7f78dc3d31142226b8c29cce38d5d3a86f03.zip
tcl-3c1b7f78dc3d31142226b8c29cce38d5d3a86f03.tar.gz
tcl-3c1b7f78dc3d31142226b8c29cce38d5d3a86f03.tar.bz2
Backout uncomplete fix for [3422267ed6b79922]: segmentation fault from deleting the the target of an imported alias during a trace on the target of the alias.
Since it causes build failures.
-rw-r--r--generic/tclNamesp.c7
-rw-r--r--generic/tclProc.c7
-rw-r--r--tests/interp.test37
3 files changed, 1 insertions, 50 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index fea23aa..26dca62 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -959,7 +959,7 @@ Tcl_DeleteNamespace(
/*
* If the namespace has associated ensemble commands, delete them first.
* This leaves the actual contents of the namespace alone (unless they are
- * linked ensemble commands, of course). This code is
+ * linked ensemble commands, of course). Note that this code is actually
* reentrant so command delete traces won't purturb things badly.
*/
@@ -1770,9 +1770,7 @@ DoImport(
TclInvokeImportedCmd, InvokeImportedNRCmd, dataPtr,
DeleteImportedCmd);
dataPtr->realCmdPtr = cmdPtr;
- cmdPtr->refCount++;
dataPtr->selfPtr = (Command *) importedCmd;
- dataPtr->selfPtr->refCount++;
dataPtr->selfPtr->compileProc = cmdPtr->compileProc;
Tcl_DStringFree(&ds);
@@ -1783,7 +1781,6 @@ DoImport(
refPtr = (ImportRef *)ckalloc(sizeof(ImportRef));
refPtr->importedCmdPtr = (Command *) importedCmd;
- refPtr->importedCmdPtr->refCount++;
refPtr->nextPtr = cmdPtr->importRefPtr;
cmdPtr->importRefPtr = refPtr;
} else {
@@ -2079,9 +2076,7 @@ DeleteImportedCmd(
} else {
prevPtr->nextPtr = refPtr->nextPtr;
}
- TclCleanupCommandMacro(refPtr->importedCmdPtr);
ckfree(refPtr);
- TclCleanupCommandMacro(selfPtr)
ckfree(dataPtr);
return;
}
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 150d036..0d67c37 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -215,7 +215,6 @@ Tcl_ProcObjCmd(
*/
procPtr->cmdPtr = (Command *) cmd;
- procPtr->cmdPtr->refCount++;
/*
* TIP #280: Remember the line the procedure body is starting on. In a
@@ -2155,12 +2154,6 @@ TclProcCleanupProc(
ckfree(localPtr);
localPtr = nextPtr;
}
- /*
- * TclOOMethod.c:clOOMakeProcMethod sets cmdPtr to NULL
- */
- if (procPtr->cmdPtr) {
- TclCleanupCommandMacro(procPtr->cmdPtr);
- }
ckfree(procPtr);
/*
diff --git a/tests/interp.test b/tests/interp.test
index 9287756..599ac08 100644
--- a/tests/interp.test
+++ b/tests/interp.test
@@ -3664,43 +3664,6 @@ test interp-38.8 {interp debug basic setup} -body {
} -returnCodes {
error
} -result {wrong # args: should be "interp debug path ?-frame ?bool??"}
-
-test interp-39.0 {
- no segmentation fault when a command is deleted
-} -body {
- variable res {}
-
- proc p1 args {
- return success
- }
- namespace eval ns1 {
- namespace export *
- }
- interp alias {} [namespace current]::ns1::p2 {} [namespace current]::p1
- namespace eval ns2 {
- namespace import [namespace parent]::ns1::p2
- }
- proc ondelete {oldname newname op} {
- variable res
- namespace delete ns1
- catch {
- ns1::p2
- } res
- }
-
- trace add command ns2::p2 delete [namespace which ondelete]
- rename ns2::p2 {}
- rename p1 {}
- if {
- [string match {*invalid command name*ns1::p2*} $res]
- } {
- return 1
- } else {
- return $res
- }
-} -cleanup {
-} -result 1
-
# cleanup
unset -nocomplain hidden_cmds