diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2015-11-21 22:22:49 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2015-11-21 22:22:49 (GMT) |
commit | e922cb1cd3d13490b9f58bc1ff9a09dae1c5f77c (patch) | |
tree | 0eeb703224f6ae757ab409e4196bc4b0ceb50199 /tests | |
parent | a166c55da0595a28b635191dbb6307cbb85428d4 (diff) | |
download | tcl-e922cb1cd3d13490b9f58bc1ff9a09dae1c5f77c.zip tcl-e922cb1cd3d13490b9f58bc1ff9a09dae1c5f77c.tar.gz tcl-e922cb1cd3d13490b9f58bc1ff9a09dae1c5f77c.tar.bz2 |
[3d96b7076e] Prevent crashes when destroying an object's class inside a method call.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/oo.test | 51 |
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] |