From 3287f6c3a5c077096c5c7fc57423efca85e12336 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 23 Feb 2010 14:23:31 +0000 Subject: [PATCH] Regression test for 34394ecd - SVs that were only on the tmps stack leaked. --- t/op/threads.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/op/threads.t b/t/op/threads.t index 588b969..956102a 100644 --- a/t/op/threads.t +++ b/t/op/threads.t @@ -16,7 +16,7 @@ BEGIN { exit 0; } - plan(17); + plan(18); } use strict; @@ -225,4 +225,16 @@ print create threads sub { //"undef" EOJ +# At the point of thread creation, $h{1} is on the temps stack. +# The weak reference $a, however, is visible from the symbol table. +fresh_perl_is(<<'EOI', 'ok', { }, 'Test for 34394ecd06e704e9'); + use threads; + %h = (1, 2); + use Scalar::Util 'weaken'; + $a = \$h{1}; + weaken($a); + delete $h{1} && threads->create(sub {}, shift)->join(); + print 'ok'; +EOI + # EOF -- 1.8.3.1