summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-10-29 20:45:34 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-10-29 21:50:24 -0700
commit00169e2cdde29138824a7bf6b66d5875aaa8278d (patch)
treeaeb3b50ba3698ec9d26053d42e414fda70a983ba /mg.c
parentbc56db2a697ebe59892fabdcfa5aa910ed4f2885 (diff)
downloadperl-00169e2cdde29138824a7bf6b66d5875aaa8278d.tar.gz
Switch the core MRO code over to HvENAME
This has the side-effect of fixing these one-liners: $ perl5.13.5 -le' my $glob = \*foo::ISA; delete $::{"foo::"}; *$glob = *a' Bus error $ perl5.13.5 -le' my $glob = \*foo::ISA; delete $::{"foo::"}; *$glob = []' Bus error $ perl5.13.6 -le'sub baz; my $glob = \*foo::bar; delete $::{"foo::"}; *$glob = *baz;' Bus error $ perl5.13.6 -le'sub foo::bar; my $glob = \*foo::bar; delete $::{"foo::"}; *$glob = *baz;' Bus error In the first two cases the crash was inadvertently fixed (isn’t it nice when that happens?) in 5.13.6 (by 6f86b615fa7), but there was still a fatal error: Can't call mro_isa_changed_in() on anonymous symbol table at -e line 1. Because sv_clear calls ->DESTROY, if an object’s stash has been detached from the symbol table, mro_get_linear_isa can be called on a hash with no HvENAME. So HvNAME is used as a fallback for those cases.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index 03ff000325..4a1a72b668 100644
--- a/mg.c
+++ b/mg.c
@@ -1630,7 +1630,9 @@ Perl_magic_clearisa(pTHX_ SV *sv, MAGIC *mg)
: (const GV *)mg_find(mg->mg_obj, PERL_MAGIC_isa)->mg_obj
);
- if (stash)
+ /* The stash may have been detached from the symbol table, so check its
+ name before doing anything. */
+ if (stash && HvENAME_get(stash))
mro_isa_changed_in(stash);
return 0;