# http://rt.perl.org/rt3/Public/Bug/Display.html?id=52074 # http://rt.perl.org/rt3/Public/Bug/Display.html?id=54566 # http://perl5.git.perl.org/perl.git/commitdiff/5562fa714b8071354c365365c26a950efa73179a?hp=b3562f19ee0d76b60d176a0b1cfdac4f5f36785c # http://perl5.git.perl.org/perl.git/commitdiff/ea86b3de3510ce31d0c08dd6a21701d74b25369d?hp=72bfe1b2b35945ea3c95d9b94ae2908121292236 diff --git a/mg.c b/mg.c index c4d7aeb..91a36f2 100644 --- mg.c +++ mg.c @@ -1543,10 +1543,11 @@ Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg) stash = GvSTASH( SvTYPE(mg->mg_obj) == SVt_PVGV ? (GV*)mg->mg_obj - : (GV*)SvMAGIC(mg->mg_obj)->mg_obj + : (GV*)mg_find(mg->mg_obj, PERL_MAGIC_isa)->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 --- t/mro/pkg_gen.t +++ 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");