Re: [perl #39145] win32, @_ and fork crashing in dounwind
David Mitchell [Wed, 17 May 2006 17:38:16 +0000 (18:38 +0100)]
Message-ID: <20060517163816.GN17109@iabyn.com>

(Dave's fix, plus a test taken from [perl #39145])

p4raw-id: //depot/perl@28215

sv.c
t/op/fork.t

diff --git a/sv.c b/sv.c
index c7223c4..4c186ec 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -10271,6 +10271,8 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param)
                ncx->blk_sub.hasargs    = cx->blk_sub.hasargs;
                ncx->blk_sub.lval       = cx->blk_sub.lval;
                ncx->blk_sub.retop      = cx->blk_sub.retop;
+               ncx->blk_sub.oldcomppad = (PAD*)ptr_table_fetch(PL_ptr_table,
+                                          cx->blk_sub.oldcomppad);
                break;
            case CXt_EVAL:
                ncx->blk_eval.old_in_eval = cx->blk_eval.old_in_eval;
index 588d88b..b344990 100755 (executable)
@@ -462,3 +462,9 @@ if ($pid == 0) {
 }
 EXPECT
 1
+########
+# [perl #39145] Perl_dounwind() crashing with Win32's fork() emulation
+sub { @_ = 3; fork ? die "1\n" : die "1\n" }->(2);
+EXPECT
+1
+1