summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-07-18 15:07:08 +0100
committerDavid Mitchell <davem@iabyn.com>2010-07-18 18:39:18 +0100
commitcfc1e951d98ba2b9a0e066aba9aadba4cd919eec (patch)
tree035e1c687d0f681990220c6e3f4db9317252fd3e /sv.c
parent00c0cb6d254eaba165c8445a6e68686b8285b5a3 (diff)
downloadperl-cfc1e951d98ba2b9a0e066aba9aadba4cd919eec.tar.gz
add CVf_CVGV_RC flag
after the recent commit 803f274831f937654d48f8cf0468521cbf8f5dff, the CvGV field is sometimes reference counted. Since it was intended that the reference counting would happen only for anonymous CVs, the CVf_ANON flag was co-opted to indicate whether RC was being used. This is not entirely robust; for example, sub __ANON__ {} is a non-anon sub which points to the same GV used by anon subs, which while itself doesn't directly break things, shows that the potential for breakage is there. So add a separate flag just to indicate the reference count status of the CvGV field.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index f555fc15ac..1e756f2420 100644
--- a/sv.c
+++ b/sv.c
@@ -5687,6 +5687,7 @@ S_anonymise_cv_maybe(pTHX_ GV *gv, CV* cv)
SvREFCNT_dec(gvname);
CvANON_on(cv);
+ CvCVGV_RC_on(cv);
CvGV(cv) = MUTABLE_GV(SvREFCNT_inc(anongv));
}
@@ -11438,7 +11439,7 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
/* don't dup if copying back - CvGV isn't refcounted, so the
* duped GV may never be freed. A bit of a hack! DAPM */
CvGV(dstr) =
- CvANON(dstr)
+ CvCVGV_RC(dstr)
? gv_dup_inc(CvGV(sstr), param)
: (param->flags & CLONEf_JOIN_IN)
? NULL