correctly clone eval context frames
authorZefram <zefram@fysh.org>
Sat, 18 Feb 2012 11:31:48 +0000 (11:31 +0000)
committerZefram <zefram@fysh.org>
Sat, 18 Feb 2012 11:43:18 +0000 (11:43 +0000)
When cloning stacks (only used for Win32 fork emulation, not for ordinary
threads), the CV referenced by an eval context frame wasn't being cloned.
This led to crashes when Win32 forked inside an eval [perl #109718].

sv.c

diff --git a/sv.c b/sv.c
index f03f475..821376e 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -12316,6 +12316,7 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param)
                ncx->blk_eval.old_namesv = sv_dup_inc(ncx->blk_eval.old_namesv,
                                                      param);
                ncx->blk_eval.cur_text  = sv_dup(ncx->blk_eval.cur_text, param);
+               ncx->blk_eval.cv = cv_dup(ncx->blk_eval.cv, param);
                break;
            case CXt_LOOP_LAZYSV:
                ncx->blk_loop.state_u.lazysv.end
@@ -12349,6 +12350,8 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ix, I32 max, CLONE_PARAMS* param)
                break;
            case CXt_BLOCK:
            case CXt_NULL:
+           case CXt_WHEN:
+           case CXt_GIVEN:
                break;
            }
        }