weakref fix 2, not yet there
Artur Bergman [Sat, 30 Jun 2001 01:18:16 +0000 (03:18 +0200)]
Message-ID: <B762D957.1CC9%artur@contiller.se>

p4raw-id: //depot/perl@11040

sv.c

diff --git a/sv.c b/sv.c
index cc8fe4a..207b955 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -8628,6 +8628,18 @@ S_gv_share(pTHX_ SV *sstr)
     else if (!GvCV(gv)) {
         GvCV(gv) = (CV*)sv;
     }
+   else if(mg->mg_type == PERL_MAGIC_backref) {
+       AV *av = (AV*) mg->mg_obj;
+       SV **svp;
+       I32 i;
+       nmg->mg_obj = (SV*)newAV();
+       svp = AvARRAY(av);
+       i = AvFILLp(av);
+       while (i >= 0) {
+           av_push((AV*)nmg->mg_obj,sv_dup(svp[i],param));
+           i--;
+       }
+    }
     else {
         /* CvPADLISTs cannot be shared */
         if (!CvXSUB(GvCV(gv))) {