From 9d390b7de5088a99eef2ce0c5c992eacc9148bc8 Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 16 Sep 2024 16:05:35 +0000 Subject: [708422] Nice test case. Bug report duplicates [7842f33a5c] --- tests/oo.test | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/oo.test b/tests/oo.test index 502b3f7..38a7cad 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1765,6 +1765,31 @@ test oo-11.7 {Bug 154f0982f2: createWithNamespace and an existing namespace} -se Aclass destroy catch {namespace delete test_oo117} } -result {can't create namespace "::test_oo117": already exists} +test oo-11.8 {Bug 708422: unset traces in deletion shouldn't crash} -setup { + oo::class create foo { + self export createWithNamespace + method dummy {} {} + } + set result {} +} -body { + oo::define foo { + variable x + constructor {} { + trace add variable x unset [list apply {{self ns args} { + global result + lappend result [info object isa object $self] + lappend result [namespace exists $ns] + # Method dispatch fails; too much gone in this case + catch {$self dummy} msg + lappend result $msg + }} [self] [self namespace]] + } + } + [foo createWithNamespace bar oo-11.8] destroy + return $result +} -cleanup { + foo destroy +} -result {1 0 {impossible to invoke method "dummy": no defined method or unknown method}} test oo-12.1 {OO: filters} { oo::class create Aclass -- cgit v0.12