From: Artur Bergman Date: Sun, 26 Jan 2003 22:37:21 +0000 (+0000) Subject: When we copy things out of a hash and increment the X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b747d46a2a9b2369f2eba3e795bd8d6856597ace;p=p5sagit%2Fp5-mst-13.2.git When we copy things out of a hash and increment the refcount of the shared scalar, we really must protect that refcount increase with a lock, or else it might not happen. Fixes segfault when objects would prematurely be killed. p4raw-id: //depot/perl@18593 --- diff --git a/ext/threads/shared/shared.xs b/ext/threads/shared/shared.xs index c5a210f..a3f27e7 100644 --- a/ext/threads/shared/shared.xs +++ b/ext/threads/shared/shared.xs @@ -672,7 +672,9 @@ sharedsv_array_mg_copy(pTHX_ SV *sv, MAGIC* mg, MAGIC *nmg = sv_magicext(nsv,mg->mg_obj, toLOWER(mg->mg_type),&sharedsv_elem_vtbl, name, namlen); + ENTER_LOCK; SvREFCNT_inc(SHAREDSvPTR(shared)); + LEAVE_LOCK; nmg->mg_flags |= MGf_DUP; return 1; }