summaryrefslogtreecommitdiff
path: root/t/op/closure.t
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-01-20 00:16:42 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-01-20 00:16:42 +0000
commitb36bdecab13f885c556206f71bfc47083b33107e (patch)
treecf1e451df96791b01c3da200598c5312387dbbcc /t/op/closure.t
parent1bf2966364b6356e9050b17d8920dd4a8ce27d97 (diff)
downloadperl-b36bdecab13f885c556206f71bfc47083b33107e.tar.gz
second attempt to fix [perl #24914] freeing a CV reference that was
currently being executed caused coredumps. The dounwind called by die unwinds all the contexts on the context stack before unwinding the save stack. To stop premature freeing of the CV, hold references to it on both stacks. p4raw-id: //depot/perl@22182
Diffstat (limited to 't/op/closure.t')
-rwxr-xr-xt/op/closure.t14
1 files changed, 13 insertions, 1 deletions
diff --git a/t/op/closure.t b/t/op/closure.t
index 2425a59a61..f9da3114e7 100755
--- a/t/op/closure.t
+++ b/t/op/closure.t
@@ -13,7 +13,7 @@ BEGIN {
use Config;
-print "1..185\n";
+print "1..186\n";
my $test = 1;
sub test (&) {
@@ -668,4 +668,16 @@ __EOF__
END { 1 while unlink $progfile }
}
+{
+ # bugid #24914 = used to coredump restoring PL_comppad in the
+ # savestack, due to the early freeing of the anon closure
+
+ my $got = runperl(stderr => 1, prog =>
+'sub d {die} my $f; $f = sub {my $x=1; $f = 0; d}; eval{$f->()}; print qw(ok)'
+ );
+ test { $got eq 'ok' };
+}
+
+
+