summaryrefslogtreecommitdiff
path: root/proto.h
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 /proto.h
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 'proto.h')
-rw-r--r--proto.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 769d3bd9d8..74c4138e77 100644
--- a/proto.h
+++ b/proto.h
@@ -6575,6 +6575,11 @@ STATIC void S_assert_uft8_cache_coherent(pTHX_ const char *const func, STRLEN fr
#define PERL_ARGS_ASSERT_ASSERT_UFT8_CACHE_COHERENT \
assert(func); assert(sv)
+STATIC bool S_curse(pTHX_ SV * const sv, const bool check_refcnt)
+ __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_CURSE \
+ assert(sv)
+
STATIC I32 S_expect_number(pTHX_ char **const pattern)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);