summaryrefslogtreecommitdiff
path: root/pad.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-04-09 20:11:47 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-04-10 14:52:59 -0700
commit253649d90a449f693eda6b1f50f33c291d5ae594 (patch)
treeeb8fb13ae10105cf142777b54d42bae8ca55d71f /pad.h
parent35c5736572cfe7a326c2bcdd39a98c514d54d038 (diff)
downloadperl-253649d90a449f693eda6b1f50f33c291d5ae594.tar.gz
[perl #109718] Clone PL_comppad properly
fork emulation on Windows, which clones a new thread via perl_clone_using, expects to be able to access the current pad imme- diately after the cloning, and crashes if there is no current pad. PL_comppad was not being cloned explicitly, but simply looked up in the pointer table, it being assumed that it had already been cloned. For string evals, before commit 676a678, PL_compcv happened to point to the eval’s CV. PL_compcv is cloned just before PL_comppad is set, so that worked. As of commit 676a678, PL_compcv does not point to the eval’s CV at the eval’s run time, so the pad has not been cloned yet when PL_comppad is set. In the case of string evals, the CV does get cloned, but later on, after PL_comppad is set, when the stacks are cloned. Changing the setting of PL_comppad to do an actual cloning works, as, when the eval’s CV is cloned later (during stack cloning), it will simply pick up the pad that has already been cloned and is waiting for it in the pointer table. This stops eval 'fork' from crashing on Windows.
Diffstat (limited to 'pad.h')
-rw-r--r--pad.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/pad.h b/pad.h
index ddde4d7df1..aa6521ff9b 100644
--- a/pad.h
+++ b/pad.h
@@ -338,7 +338,7 @@ Clone the state variables associated with running and compiling pads.
* sub's CV or padlist. */
#define PAD_CLONE_VARS(proto_perl, param) \
- PL_comppad = MUTABLE_AV(ptr_table_fetch(PL_ptr_table, proto_perl->Icomppad)); \
+ PL_comppad = av_dup(proto_perl->Icomppad, param); \
PL_curpad = PL_comppad ? AvARRAY(PL_comppad) : NULL; \
PL_comppad_name = av_dup(proto_perl->Icomppad_name, param); \
PL_comppad_name_fill = proto_perl->Icomppad_name_fill; \