From: Rafael Garcia-Suarez Date: Tue, 15 Apr 2008 08:36:48 +0000 (+0000) Subject: Fix for [perl #52074] Segfault on ISA push after symbol table delete X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5562fa714b8071354c365365c26a950efa73179a;p=p5sagit%2Fp5-mst-13.2.git Fix for [perl #52074] Segfault on ISA push after symbol table delete This restores the 5.8.8 behaviour. The deleted stash is not vivified again, hence the hierarchy remains broken. But there's no segfault. p4raw-id: //depot/perl@33684 --- diff --git a/mg.c b/mg.c index 0bc7979..dfe1fb7 100644 --- a/mg.c +++ b/mg.c @@ -1607,7 +1607,8 @@ Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg) : (GV*)SvMAGIC(mg->mg_obj)->mg_obj ); - mro_isa_changed_in(stash); + if (stash) + mro_isa_changed_in(stash); return 0; } @@ -1632,7 +1633,8 @@ Perl_magic_clearisa(pTHX_ SV *sv, MAGIC *mg) : (GV*)SvMAGIC(mg->mg_obj)->mg_obj ); - mro_isa_changed_in(stash); + if (stash) + mro_isa_changed_in(stash); return 0; } diff --git a/t/mro/pkg_gen.t b/t/mro/pkg_gen.t index 6a507ac..e1f5eb0 100644 --- a/t/mro/pkg_gen.t +++ b/t/mro/pkg_gen.t @@ -4,7 +4,7 @@ use strict; use warnings; chdir 't' if -d 't'; -require q(./test.pl); plan(tests => 6); +require q(./test.pl); plan(tests => 7); { package Foo; @@ -34,3 +34,7 @@ is(mro::get_pkg_gen('Foo'), 1, "pkg_gen 1 for undef %Pkg::"); delete $::{"Foo::"}; is(mro::get_pkg_gen('Foo'), 0, 'pkg_gen 0 for delete $::{Pkg::}'); + +delete $::{"Quux::"}; +push @Quux::ISA, "Woot"; # should not segfault +ok(1, "No segfault on modification of ISA in a deleted stash");