Skip to content

Commit

Permalink
Add a weaken() cycle forgotten in d63c9e6
Browse files Browse the repository at this point in the history
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;
  • Loading branch information
ribasushi committed Apr 14, 2016
1 parent ef25a42 commit 29211e0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/DBIx/Class/_Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ sub is_exception ($) {
values %$destruction_registry
};

weaken( $destruction_registry->{$_} )
for keys %$destruction_registry;

This comment has been minimized.

Copy link
@ilmari

ilmari Apr 14, 2016

Contributor

Why not just weaken($_) for values %$destruction_registry?

This comment has been minimized.

Copy link
@ribasushi

ribasushi Apr 15, 2016

Author Collaborator

Why not just weaken($_) for values %$destruction_registry?

@ilmari because lack of sleep. Thanks for catching this, now fixed as part of d098704fa


# 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
Expand Down

0 comments on commit 29211e0

Please sign in to comment.