This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #36347] Object destruction incomplete
authorFather Chrysostomos <sprout@cpan.org>
Sun, 2 Jan 2011 22:51:21 +0000 (14:51 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 3 Jan 2011 02:33:05 +0000 (18:33 -0800)
commit4155e4fe81b9987a30efea627e43a574f5460f73
tree707c9726e1f53d5a85d30a8fb2d4294e66d4523a
parentfd520d362aeb1b4dd5c384035916a9d3f3db5d35
[perl #36347] Object destruction incomplete

do_clean_objs only looks for objects referenced by RVs, so blessed
array references and lexical variables (and probably other SVs, too)
are not DESTROYed.

This commit adds a new visit() call to sv_clean_objs, which curses
(DESTROYs and un-blesses, leaving the reference count as it is) any
objects that are still left after do_clean_named_io_objs. The new
do_curse routine (a pointer to which is passeds to visit()) follows
do_clean_named_io_objs’ example and explicitly skips the STDOUT and
STDERR handles, in case destructors need to use them.

The cursing code, which is now called from two places, is moved out of
sv_clear and put in its own routine. The check that the reference
count is zero does not apply when called from sv_clean_objs, so the
new S_curse routine takes a boolean argument that determines whether
that check should take place.
embed.fnc
embed.h
proto.h
sv.c