diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-08-28 07:24:53 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-08-28 07:24:53 -0700 |
commit | db5cc3ee5bdb14c8d59302b6c3ef8ff4bca660bb (patch) | |
tree | fbe560399f3aa944f0d3891c47ce1144ced910b7 /gv.c | |
parent | 56117e3ef4ef2c7986c400f86f321f22f261571a (diff) | |
download | perl-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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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)); |