This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Stop renamed packages from making reset() crash
authorFather Chrysostomos <sprout@cpan.org>
Wed, 5 Dec 2012 20:53:30 +0000 (12:53 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 6 Dec 2012 05:31:42 +0000 (21:31 -0800)
commit230834321e308444d408bdbf755d181b67e82d4c
tree0775daf798c8ecb31604e073e21eeba3a65b9375
parentbcea25a760263ce058f5588c6ae62af6f09a211e
Stop renamed packages from making reset() crash

This only affected threaded builds.  I think the comments in the added
test explain well enough what was happening.

The solution is to store a stashpad offset in the pmop, instead of the
name of the stash.  This is similar to what was done with cop stashes
in d4d03940c58a.

Not only does this fix the crash, but it also makes compilation faster
and saves memory (no separate malloc for every m?pat?).

I had to move Safefree(PL_stashpad) later on in perl_destruct, because
freeing a pmop causes the PL_stashpad to be accessed, and pmops can be
freed during sv_clean_all.  Its previous location was not a problem
for cops, as PL_stashpad[cop->cop_stashoff] is only accessed when
PL_curcop==that_cop and Perl code is running, not when cops are freed.
embed.fnc
embed.h
op.c
op.h
perl.c
proto.h
t/op/reset.t