summaryrefslogtreecommitdiff
path: root/embed.fnc
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-01-02 14:51:21 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-01-02 18:33:05 -0800
commit4155e4fe81b9987a30efea627e43a574f5460f73 (patch)
tree707c9726e1f53d5a85d30a8fb2d4294e66d4523a /embed.fnc
parentfd520d362aeb1b4dd5c384035916a9d3f3db5d35 (diff)
downloadperl-4155e4fe81b9987a30efea627e43a574f5460f73.tar.gz
[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.
Diffstat (limited to 'embed.fnc')
-rw-r--r--embed.fnc3
1 files changed, 3 insertions, 0 deletions
diff --git a/embed.fnc b/embed.fnc
index ab957666cd..57d71d6b85 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1169,6 +1169,9 @@ pd |I32 |sv_clean_all
: Used only in perl.c
pd |void |sv_clean_objs
Apd |void |sv_clear |NN SV *const orig_sv
+#if defined(PERL_IN_SV_C)
+s |bool |curse |NN SV * const sv|const bool check_refcnt
+#endif
Aopd |I32 |sv_cmp |NULLOK SV *const sv1|NULLOK SV *const sv2
Apd |I32 |sv_cmp_flags |NULLOK SV *const sv1|NULLOK SV *const sv2 \
|const U32 flags