develooper Front page | perl.perl5.porters | Postings from July 2009

Re: @ISA lookup issue in blead and maint-5.10

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
July 25, 2009 09:16
Subject:
Re: @ISA lookup issue in blead and maint-5.10
Message ID:
20090725161553.GU60303@plum.flirble.org
Sorry for the delay in replying.

On Sat, May 30, 2009 at 05:07:25PM +0200, Torsten Schoenfeld wrote:
> Nicholas Clark wrote:
> >Is PL_delaymagic 0? If not, which line of code set it non-zero?
> >If it is, does the call to mg_set() correctly end up in magic_setisa()?
> >And does that get a non-NULL stash, and hence call this code?
> 
> PL_delaymagic is 0 and magic_setisa() is called.  It gets an apparently 
> valid stash and calls mro_isa_changed_in().  stashname in 
> mro_isa_changed_in() is "Glib::InitiallyUnowned", so that seems correct.  
> The mro_meta struct it then fetches comes out as
> 
>  {mro_linear_all = 0x0, mro_linear_current = 0xa4980bc,
>   mro_nextmethod = 0x0, cache_gen = 3, pkg_gen = 3, mro_which = 0x8381ab8,
>   isa = 0xa4980ec}.
> 
> The isarev loop then first finds "Bar" with mro_meta struct
> 
>  {mro_linear_all = 0x0, mro_linear_current = 0x92c317c,
>   mro_nextmethod = 0x0, cache_gen = 4, pkg_gen = 4, mro_which = 0x8381ab8,
>   isa = 0x92c319c},
> 
> and then "Foo" with
> 
>  {mro_linear_all = 0x0, mro_linear_current = 0x92c30bc,
>   mro_nextmethod = 0x0, cache_gen = 4, pkg_gen = 4, mro_which = 0x8381ab8,
>   isa = 0x92c30dc}.
> 
> The mro_get_linear_isa() loop at the end is not executed since items is 0.
> 
> I hope this helps,

Thanks. I think it did in the end, by helping me rule out something.

I believe I've fixed the problem in blead with 1375cf1cf2085f851bb17604

diff --git a/mro.c b/mro.c
index fe77647..23f8c07 100644
--- a/mro.c
+++ b/mro.c
@@ -438,7 +438,7 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
     if(meta->mro_nextmethod) hv_clear(meta->mro_nextmethod);
 
     /* Iterate the isarev (classes that are our children),
-       wiping out their linearization and method caches */
+       wiping out their linearization, method and isa caches */
     if(isarev) {
         hv_iterinit(isarev);
         while((iter = hv_iternext(isarev))) {
@@ -463,6 +463,10 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
                 revmeta->cache_gen++;
             if(revmeta->mro_nextmethod)
                 hv_clear(revmeta->mro_nextmethod);
+	    if (revmeta->isa) {
+		SvREFCNT_dec(revmeta->isa);
+		revmeta->isa = NULL;
+	    }
         }
     }



Without this, I can replicate the problem.
With this, Glib passes all tests on my* machine.

Does this work for you?

Nicholas Clark

* not actually mine, but I have an account on it.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About