summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-06-23 21:30:33 +0000
committerNicholas Clark <nick@ccl4.org>2005-06-23 21:30:33 +0000
commite15faf7d09c73a41f95fbe6a0045ad5b17c899a6 (patch)
tree63afe41128dd7c7aaaf6effdfaa6ab9d91145647 /gv.c
parent8772537cf6d022a54f738ccb84b65a7f21ccf1b2 (diff)
downloadperl-e15faf7d09c73a41f95fbe6a0045ad5b17c899a6.tar.gz
Remove the reference loop between symbol tables and typeglobs.
Typeglobs now have a weak reference onto their symbol table. p4raw-id: //depot/perl@24966
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 aaae2a2f53..7a078e80a6 100644
--- a/gv.c
+++ b/gv.c
@@ -132,7 +132,9 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi)
GvCVGEN(gv) = 0;
GvEGV(gv) = gv;
sv_magic((SV*)gv, (SV*)gv, PERL_MAGIC_glob, Nullch, 0);
- GvSTASH(gv) = (HV*)SvREFCNT_inc(stash);
+ GvSTASH(gv) = stash;
+ if (stash)
+ Perl_sv_add_backref(aTHX_ (SV*)stash, (SV*)gv);
GvNAME(gv) = savepvn(name, len);
GvNAMELEN(gv) = len;
if (multi || doproto) /* doproto means it _was_ mentioned */