From: Nicholas Clark Date: Tue, 23 Feb 2010 14:23:31 +0000 (+0000) Subject: Regression test for 34394ecd - SVs that were only on the tmps stack leaked. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3287f6c3a5c077096c5c7fc57423efca85e12336;p=p5sagit%2Fp5-mst-13.2.git Regression test for 34394ecd - SVs that were only on the tmps stack leaked. --- 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