Skip to content

Commit

Permalink
Don't destroy P5 objects after the P5 interpreter was shut down
Browse files Browse the repository at this point in the history
We run the default_perl5 object's DESTROY method unconditionally in the END.
If after that the GC runs, it may DESTROY wrapped Perl 5 objects. If we
try to decrement their reference count, we're in no-mans-land and may
encounter undesireable effects like segfaults. So don't do that.
  • Loading branch information
niner committed Aug 1, 2015
1 parent 29f2bea commit eb00360
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/Inline/Perl5.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ method init_callbacks {
}

method sv_refcnt_dec($obj) {
return unless $!p5; # Destructor may already have run. Destructors of individual P5 objects no longer work.
p5_sv_refcnt_dec($!p5, $obj);
}

Expand Down

0 comments on commit eb00360

Please sign in to comment.