This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
protect CvSTASH weakref with backrefs
authorDavid Mitchell <davem@iabyn.com>
Mon, 5 Jul 2010 19:40:33 +0000 (20:40 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 14 Jul 2010 22:06:17 +0000 (23:06 +0100)
commit4c74a7df3242aa95d62dcfbcc231b8a55cc03c59
tree40e1d5a912f0d7cfb9868075dda2ee1c5dcfcb7a
parente3d2b9e76ba8553f994404cc1438760e83dd8b76
protect CvSTASH weakref with backrefs

Each CV usually has a pointer, CvSTASH, back to the stash that it was
complied in. This pointer isn't reference counted, to avoid loops. Which
can leave it dangling if the stash is deleted.

There is already protection for the similar GvSTASH field in GVs: the
stash has an array of backrefs, xhv_backreferences, pointing to the GVs
whose GvSTASHes point to it, and which is used to zero all the GvSTASH
fields should the stash be deleted.

All this patch does is also add the CVs with CvSTASH to that stash's
backref list too.
embed.fnc
embed.h
global.sym
gv.c
hv.c
op.c
pad.c
proto.h
sv.c
t/op/stash.t