summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-10-22 11:06:35 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-10-22 16:09:59 -0700
commit03d9f026ae253e9e69212a3cf6f1944437e9f070 (patch)
tree3c21bc6f46fb6b331a571f5c095fea8660fb1213 /sv.c
parentac73ea1ec401df889d312b067f78b618f7ffecc3 (diff)
downloadperl-03d9f026ae253e9e69212a3cf6f1944437e9f070.tar.gz
[perl #101486] Make PL_curstash refcounted
This stops PL_curstash from pointing to a freed-and-reused scalar in cases like ‘package Foo; BEGIN {*Foo:: = *Bar::}’. In such cases, another BEGIN block, or any subroutine definition, would cause a crash. Now it just happily proceeds. newATTRSUB and newXS have been modified not to call mro_method_changed_in in such cases, as it doesn’t make sense.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index 3efbc39ea7..2e0553ac73 100644
--- a/sv.c
+++ b/sv.c
@@ -13212,7 +13212,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
/* symbol tables */
PL_defstash = hv_dup_inc(proto_perl->Idefstash, param);
- PL_curstash = hv_dup(proto_perl->Icurstash, param);
+ PL_curstash = hv_dup_inc(proto_perl->Icurstash, param);
PL_debstash = hv_dup(proto_perl->Idebstash, param);
PL_globalstash = hv_dup(proto_perl->Iglobalstash, param);
PL_curstname = sv_dup_inc(proto_perl->Icurstname, param);