Change 31475 by [EMAIL PROTECTED] on 2007/06/26 21:25:15
avoid double-free of the thread function
Affected files ...
... //depot/perl/ext/threads/threads.xs#141 edit
... //depot/perl/t/op/threads.t#11 edit
Differences ...
==== //depot/perl/ext/threads/threads.xs#141 (xtext) ====
Index: perl/ext/threads/threads.xs
--- perl/ext/threads/threads.xs#140~31238~ 2007-05-18 15:48:12.000000000
-0700
+++ perl/ext/threads/threads.xs 2007-06-26 14:25:15.000000000 -0700
@@ -688,10 +688,8 @@
thread->init_function = newSV(0);
sv_copypv(thread->init_function, init_function);
} else {
- thread->init_function = sv_dup(init_function, &clone_param);
- if (SvREFCNT(thread->init_function) == 0) {
- SvREFCNT_inc_void(thread->init_function);
- }
+ thread->init_function =
+ SvREFCNT_inc(sv_dup(init_function, &clone_param));
}
thread->params = sv_dup(params, &clone_param);
==== //depot/perl/t/op/threads.t#11 (text) ====
Index: perl/t/op/threads.t
--- perl/t/op/threads.t#10~31471~ 2007-06-26 08:48:51.000000000 -0700
+++ perl/t/op/threads.t 2007-06-26 14:25:15.000000000 -0700
@@ -114,11 +114,6 @@
print do 'op/threads_create.pl' || die $@;
EOI
-
-TODO: {
- no strict 'vars'; # Accessing $TODO from test.pl
- local $TODO = 'refcount issues with threads';
-
# Attempt to free unreferenced scalar...
fresh_perl_is(<<'EOI', 'ok', { }, 'thread sub via scalar');
use threads;
@@ -135,6 +130,12 @@
print 'ok';
EOI
+TODO: {
+ no strict 'vars'; # Accessing $TODO from test.pl
+ local $TODO = 'refcount issues with threads';
+
+
+
# Scalars leaked: 1
foreach my $BLOCK (qw(CHECK INIT)) {
fresh_perl_is(<<EOI, 'ok', { }, "threads in $BLOCK block");
End of Patch.