summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2021-04-02 23:02:00 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2021-04-02 23:02:00 (GMT)
commit7d6ca39c8fc1416903f2fe01216ed2d7b435feb3 (patch)
tree8297205cb137369364a484c918276be16fcfe62c
parent171ff16f7d1431ba085c9bb1dd90d64210ffb30c (diff)
downloadtcl-7d6ca39c8fc1416903f2fe01216ed2d7b435feb3.zip
tcl-7d6ca39c8fc1416903f2fe01216ed2d7b435feb3.tar.gz
tcl-7d6ca39c8fc1416903f2fe01216ed2d7b435feb3.tar.bz2
OO cleanup fix that passes test 11.7.
-rw-r--r--generic/tclOO.c23
-rw-r--r--tests/oo.test13
2 files changed, 17 insertions, 19 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c
index 4dbe668..559cf0b 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -1184,18 +1184,19 @@ ObjectNamespaceDeleted(
* freed memory.
*/
- if (((Command *) oPtr->command)->flags && CMD_DYING) {
- /*
- * Something has already started the command deletion process. We can
- * go ahead and clean up the the namespace,
- */
- } else {
- /*
- * The namespace must have been deleted directly. Delete the command
- * as well.
- */
+ if (oPtr->command != NULL) {
+ if (((Command *) oPtr->command)->flags && CMD_DYING) {
+ /*
+ * The command is already (being) deleted. Proceed to clean up the the namespace,
+ */
+ } else {
+ /*
+ * The namespace must have been deleted directly. Delete the command
+ * as well.
+ */
- Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command);
+ Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command);
+ }
}
if (oPtr->myclassCommand) {
diff --git a/tests/oo.test b/tests/oo.test
index 404c6a4..7980f9e 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -1761,15 +1761,12 @@ test oo-11.7 {
mixed into are also deleted. If the object has been renamed into the
namespace of one of the objects it has been mixed into, the routine for the
object might get entirely deleted before the namespace of the object is
- entirely deleted, in which case the C routine the performs the namespace
- either must either understand that the handle on the routine for the object
- might now be gone, or it must be guaranteed that the handle does not
- disappear until that routine is finished.
+ entirely deleted, in which case the C routine that performs the namespace
+ deletion either must either understand that the handle on the routine for
+ the object might now be gone, or it must be guaranteed that the handle does
+ not disappear until that routine is finished.
} -setup {
} -body {
- oo::define oo::class {
- export createWithNamespace
- }
oo::class create class1
oo::object create obj1
@@ -1781,8 +1778,8 @@ test oo-11.7 {
rename class1 ${obj1ns}::class1
# No segmentation fault
namespace delete $class1ns
+ return done
} -cleanup {
- rename obj {}
} -result done