[ID 20000608.006] panic: magic_killbackrefs with blessed global weakrefs
Hugo van der Sanden [Mon, 12 Jun 2000 19:36:08 +0000 (20:36 +0100)]
Message-Id: <200006121836.TAA16977@crypt.compulink.co.uk>

p4raw-id: //depot/perl@6901

sv.c

diff --git a/sv.c b/sv.c
index 0501dcb..8778192 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -8335,9 +8335,15 @@ do_clean_objs(pTHXo_ SV *sv)
 
     if (SvROK(sv) && SvOBJECT(rv = SvRV(sv))) {
        DEBUG_D((PerlIO_printf(Perl_debug_log, "Cleaning object ref:\n "), sv_dump(sv));)
-       SvROK_off(sv);
-       SvRV(sv) = 0;
-       SvREFCNT_dec(rv);
+       if (SvWEAKREF(sv)) {
+           sv_del_backref(sv);
+           SvWEAKREF_off(sv);
+           SvRV(sv) = 0;
+       } else {
+           SvROK_off(sv);
+           SvRV(sv) = 0;
+           SvREFCNT_dec(rv);
+       }
     }
 
     /* XXX Might want to check arrays, etc. */