summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-08-28 07:24:53 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-08-28 07:24:53 -0700
commitdb5cc3ee5bdb14c8d59302b6c3ef8ff4bca660bb (patch)
treefbe560399f3aa944f0d3891c47ce1144ced910b7 /gv.c
parent56117e3ef4ef2c7986c400f86f321f22f261571a (diff)
downloadperl-db5cc3ee5bdb14c8d59302b6c3ef8ff4bca660bb.tar.gz
Fix crash in leave_scope when my sub has CvGV
Sub declaration can reuse an existing stub. So it is possible to define a package sub using a stub that was originally lexical. Hence, leave_scope needs to take into account that a my-sub may not have a name hek any more.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index e4d6acab42..7cc2c1e50c 100644
--- a/gv.c
+++ b/gv.c
@@ -232,7 +232,10 @@ Perl_cvgv_set(pTHX_ CV* cv, GV* gv)
sv_del_backref(MUTABLE_SV(oldgv), MUTABLE_SV(cv));
}
}
- else if ((hek = CvNAME_HEK(cv))) unshare_hek(hek);
+ else if ((hek = CvNAME_HEK(cv))) {
+ unshare_hek(hek);
+ CvNAMED_off(cv);
+ }
SvANY(cv)->xcv_gv_u.xcv_gv = gv;
assert(!CvCVGV_RC(cv));