summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-10-29 21:04:17 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-10-29 21:04:17 +0000
commitb34c0dd4a7081ed822e2197d6a723d2ab2fdfc86 (patch)
tree79e12d9672fac988f06daf38b445e954c784b00e /sv.c
parent2d8d5d5aa55d3bc73a36db1fc2d8bcfe8bb20516 (diff)
downloadperl-b34c0dd4a7081ed822e2197d6a723d2ab2fdfc86.tar.gz
[perl #31851] Threading crash with closures
various OpREFCNT_inc() operations weren't doing locking p4raw-id: //depot/perl@23433
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index f3575ad91f..69b9e2eed1 100644
--- a/sv.c
+++ b/sv.c
@@ -10244,7 +10244,9 @@ Perl_re_dup(pTHX_ REGEXP *r, CLONE_PARAMS *param)
case 'o':
/* Compiled op trees are readonly, and can thus be
shared without duplication. */
+ OP_REFCNT_LOCK;
d->data[i] = (void*)OpREFCNT_inc((OP*)r->data->data[i]);
+ OP_REFCNT_UNLOCK;
break;
case 'n':
d->data[i] = r->data->data[i];
@@ -10955,7 +10957,9 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param)
Perl_rvpv_dup(aTHX_ dstr, sstr, param);
CvSTASH(dstr) = hv_dup(CvSTASH(sstr), param); /* NOTE: not refcounted */
CvSTART(dstr) = CvSTART(sstr);
+ OP_REFCNT_LOCK;
CvROOT(dstr) = OpREFCNT_inc(CvROOT(sstr));
+ OP_REFCNT_UNLOCK;
CvXSUB(dstr) = CvXSUB(sstr);
CvXSUBANY(dstr) = CvXSUBANY(sstr);
if (CvCONST(sstr)) {