From: Peter Rabbitson Date: Thu, 14 Apr 2016 07:19:15 +0000 (+0200) Subject: Add a weaken() cycle forgotten in d63c9e64 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=29211e0358e2a7dbd69f68c1e10879c05fd8cdcc;p=dbsrgits%2FDBIx-Class-Historic.git Add a weaken() cycle forgotten in d63c9e64 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; --- diff --git a/lib/DBIx/Class/_Util.pm b/lib/DBIx/Class/_Util.pm index 4ff698d..6f6ac46 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -366,6 +366,9 @@ sub is_exception ($) { 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