The reason this has not been a problem is because thread spawn in DESTROY is
practically unheard of. Nevertheless if one throws the following in, the
problem becomes apparent: ( not committing this test, because... just no. )
--- a/t/storage/txn_scope_guard.t
+++ b/t/storage/txn_scope_guard.t
@@ -247,5 +247,7 @@ require DBICTest::AntiPattern::NullObject;
my @arg_capture;
{
+ use threads;
local $SIG{__WARN__} = sub {
+ threads->new(sub { sleep 1})->join;
package DB;
values %$destruction_registry
};
+ weaken( $destruction_registry->{$_} )
+ for keys %$destruction_registry;
+
# Dummy NEXTSTATE ensuring the all temporaries on the stack are garbage
# collected before leaving this scope. Depending on the code above, this
# may very well be just a preventive measure guarding future modifications