This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Reinstate "regcomp.c: Make C-array inversion lists const"
[perl5.git] / mro.c
diff --git a/mro.c b/mro.c
index 2d1d887..cb67950 100644 (file)
--- a/mro.c
+++ b/mro.c
@@ -131,7 +131,7 @@ Perl_mro_register(pTHX_ const struct mro_alg *mro) {
     if (!Perl_hv_common(aTHX_ PL_registered_mros, NULL,
                        mro->name, mro->length, mro->kflags,
                        HV_FETCH_ISSTORE, wrapper, mro->hash)) {
-       SvREFCNT_dec(wrapper);
+       SvREFCNT_dec_NN(wrapper);
        Perl_croak(aTHX_ "panic: hv_store() failed in mro_register() "
                   "for '%.*s' %d", (int) mro->length, mro->name, mro->kflags);
     }
@@ -578,6 +578,7 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
                 revmeta->cache_gen++;
             if(revmeta->mro_nextmethod)
                 hv_clear(revmeta->mro_nextmethod);
+           if (!SvOBJECT(revstash)) SvSTASH(revstash) = NULL;
 
            (void)
              hv_store(
@@ -1356,6 +1357,7 @@ Perl_mro_method_changed_in(pTHX_ HV *stash)
             mrometa->cache_gen++;
             if(mrometa->mro_nextmethod)
                 hv_clear(mrometa->mro_nextmethod);
+            if (!SvOBJECT(revstash)) SvSTASH(revstash) = NULL;
         }
     }