Given that Perl_gp_free() is refcount-dec-and-maybe-free for the glob
Nicholas Clark [Fri, 24 Feb 2006 21:42:33 +0000 (21:42 +0000)]
pointer, it's inconsistent that it only sets this GV's GvGP to 0 if
this GV happened to have the last reference. Why should this GV care if
it had the last reference? So always set it to 0. It's free. Gone.

p4raw-id: //depot/perl@27320

gv.c

diff --git a/gv.c b/gv.c
index 7197e26..0ec33ef 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1390,6 +1390,7 @@ Perl_gp_free(pTHX_ GV *gv)
     if (--gp->gp_refcnt > 0) {
        if (gp->gp_egv == gv)
            gp->gp_egv = 0;
+       GvGP(gv) = 0;
         return;
     }