develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [perl #21347] segfault in UNIVERSAL::AUTOLOAD

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
April 19, 2003 13:54
Subject:
Re: [perl #21347] segfault in UNIVERSAL::AUTOLOAD
Message ID:
20030419225808.6cc2951e.rgarciasuarez@free.fr
Enache Adrian wrote, some time ago :
> > > When the time comes for the qr// to be freed, the code inside
> > > sv_clear() tries to call its DESTROY method - since it is an
> > > object. (sv.c:5261)
> > > DESTROY doesn't exist in the 'Regexp' stash: if the user defined
> > > a UNIVERSAL::AUTOLOAD sub, that will be called instead.
> > > If that AUTOLOAD uses qr//'s, the recursion happens.
> ...
> > > I have 2 ideas to fix that:
> ...
> > > 2) Put a dummy DESTROY method in the 'Regexp' stash.
> 
> Here is a patch that does the second ( in the most naive way )

I applied it as #19277.

> I added a new test file too (t/run/crash.t) to test for this
> kind of final cleanup crashes, etc.

I moved it to t/op/ref.t.

> The first test there is
> for another bug, see
>     http://nntp.perl.org/group/perl.perl5.porters/73117
> 
> I didn't think it should be a TODO test since it's already done :)

Er, you fix doesn't work for me, or at least it ceased to work,
since I remember it worked.

That would be this test :

> +runperl(prog => 'sub UNIVERSAL::DESTROY { warn } bless \$a, A', stderr => 1);
> +ok ($? == 0, 'warn called inside UNIVERSAL::DESTROY { }');

-- 
Undermines is not *NIX

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