summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index e64c8f29f6..01ed1f574c 100644
--- a/gv.c
+++ b/gv.c
@@ -207,6 +207,7 @@ void
Perl_cvgv_set(pTHX_ CV* cv, GV* gv)
{
GV * const oldgv = CvGV(cv);
+ HEK *hek;
PERL_ARGS_ASSERT_CVGV_SET;
if (oldgv == gv)
@@ -221,8 +222,9 @@ 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);
- SvANY(cv)->xcv_gv = gv;
+ SvANY(cv)->xcv_gv_u.xcv_gv = gv;
assert(!CvCVGV_RC(cv));
if (!gv)