X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/e3918bb703cafa92e5a8d957a810cafe3334d9a1..14ca8ff4550183227342256bd45185f428ac400d:/mro.c diff --git a/mro.c b/mro.c index 1264754..be2038f 100644 --- a/mro.c +++ b/mro.c @@ -544,6 +544,9 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) /* Changes to @ISA might turn overloading on */ HvAMAGIC_on(stash); + /* DESTROY can be cached in SvSTASH. */ + if (!SvOBJECT(stash)) SvSTASH(stash) = NULL; + /* Iterate the isarev (classes that are our children), wiping out their linearization, method and isa caches and upating PL_isarev. */ @@ -575,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( @@ -1327,6 +1331,9 @@ Perl_mro_method_changed_in(pTHX_ HV *stash) /* Inc the package generation, since a local method changed */ HvMROMETA(stash)->pkg_gen++; + /* DESTROY can be cached in SvSTASH. */ + if (!SvOBJECT(stash)) SvSTASH(stash) = NULL; + /* If stash is UNIVERSAL, or one of UNIVERSAL's parents, invalidate all method caches globally */ if((stashname_len == 9 && strEQ(stashname, "UNIVERSAL")) @@ -1350,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; } }