X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FOnDestroy.pm;h=65ebd7dcf574f5aa72243add2b0df55f355d794a;hb=0d6777e0389fe2db3edce41d675320746433f5b7;hp=841f87d45eabe27ea676536f64268a88127a4953;hpb=3823705b72199c61e8ed96aabd34d21a63fe153c;p=public-inbox.git diff --git a/lib/PublicInbox/OnDestroy.pm b/lib/PublicInbox/OnDestroy.pm index 841f87d4..65ebd7dc 100644 --- a/lib/PublicInbox/OnDestroy.pm +++ b/lib/PublicInbox/OnDestroy.pm @@ -10,6 +10,11 @@ sub new { sub DESTROY { my ($cb, @args) = @{$_[0]}; + if (!ref($cb)) { + my $pid = $cb; + return if $pid != $$; + $cb = shift @args; + } $cb->(@args) if $cb; }