sv_clear: destructor may change SV type
authorDavid Mitchell <davem@iabyn.com>
Thu, 19 May 2011 15:21:07 +0000 (16:21 +0100)
committerDavid Mitchell <davem@iabyn.com>
Thu, 19 May 2011 21:01:02 +0000 (22:01 +0100)
so re-initialise the 'type' var afterwards

sv.c

diff --git a/sv.c b/sv.c
index b55d49d..1833405 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -6054,6 +6054,7 @@ Perl_sv_clear(pTHX_ SV *const orig_sv)
        if (type >= SVt_PVMG) {
            if (SvOBJECT(sv)) {
                if (!curse(sv, 1)) goto get_next_sv;
+               type = SvTYPE(sv); /* destructor may have changed it */
            }
            /* Free back-references before magic, in case the magic calls
             * Perl code that has weak references to sv. */