summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2015-11-21 22:22:49 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2015-11-21 22:22:49 (GMT)
commit6b4bc6bb8d46722088d73bd4a93f51e7fc65dbf4 (patch)
tree0eeb703224f6ae757ab409e4196bc4b0ceb50199 /tests
parent67929efb233a934a2d625216ee8d3b1d8022d33e (diff)
downloadtcl-6b4bc6bb8d46722088d73bd4a93f51e7fc65dbf4.zip
tcl-6b4bc6bb8d46722088d73bd4a93f51e7fc65dbf4.tar.gz
tcl-6b4bc6bb8d46722088d73bd4a93f51e7fc65dbf4.tar.bz2
[3d96b7076e] Prevent crashes when destroying an object's class inside a method call.
Diffstat (limited to 'tests')
-rw-r--r--tests/oo.test51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/oo.test b/tests/oo.test
index c83e015..2112f10 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -638,6 +638,57 @@ test oo-3.9 {Bug 2944404: deleting the object in the destructor} -setup {
} -cleanup {
cls destroy
} -result {in destructor}
+test oo-3.10 {Bug 3d96b7076e: killing the object's class in a method call} -setup {
+ oo::class create Super
+} -body {
+ # Only reliably failed in a memdebug build
+ oo::class create Cls {
+ superclass Super
+ method mthd {} {
+ [self class] destroy
+ return ok
+ }
+ }
+ [Cls new] mthd
+} -cleanup {
+ Super destroy
+} -result ok
+test oo-3.11 {Bug 3d96b7076e: killing the object's class in a method call} -setup {
+ oo::class create Super
+ oo::class create Sub {
+ superclass Super
+ }
+} -body {
+ # Only reliably failed in a memdebug build
+ oo::class create Cls {
+ superclass Super
+ method mthd {} {
+ oo::objdefine [self] class Sub
+ Cls destroy
+ return ok
+ }
+ }
+ [Cls new] mthd
+} -cleanup {
+ Super destroy
+} -result ok
+test oo-3.12 {Bug 3d96b7076e: killing the object's class in a method call} -setup {
+ oo::class create Super
+} -body {
+ # Only reliably failed in a memdebug build
+ oo::class create Cls {
+ superclass Super
+ method mthd {} {
+ [self class] destroy
+ return ok
+ }
+ }
+ set o [Super new]
+ oo::objdefine $o mixin Cls
+ $o mthd
+} -cleanup {
+ Super destroy
+} -result ok
test oo-4.1 {basic test of OO functionality: export} {
set o [oo::object new]