From: Jerry D. Hedden Date: Tue, 13 Dec 2005 15:11:20 +0000 (-0800) Subject: [perl #37919] Blessed scalar refs with threads::shared X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=402174ade5cfc00aa74adb59911c447ef485c570;p=p5sagit%2Fp5-mst-13.2.git [perl #37919] Blessed scalar refs with threads::shared From: "Jerry D. Hedden" (via RT) Message-Id: Unlike arrays and hashes, coping blessed refs to shared scalars left the copy unblessed p4raw-id: //depot/perl@26350 --- diff --git a/MANIFEST b/MANIFEST index 5ce2848..563d283 100644 --- a/MANIFEST +++ b/MANIFEST @@ -976,6 +976,7 @@ ext/threads/shared/shared.xs thread shared variables ext/threads/shared/t/0nothread.t Tests for basic shared array functionality. ext/threads/shared/t/av_refs.t Tests for arrays containing references ext/threads/shared/t/av_simple.t Tests for basic shared array functionality. +ext/threads/shared/t/blessed.t Test blessed shared variables ext/threads/shared/t/cond.t Test condition variables ext/threads/shared/t/disabled.t Test threads::shared when threads are disabled. ext/threads/shared/t/hv_refs.t Test shared hashes containing references diff --git a/ext/threads/shared/shared.xs b/ext/threads/shared/shared.xs index aa1dcf2..c902683 100644 --- a/ext/threads/shared/shared.xs +++ b/ext/threads/shared/shared.xs @@ -378,6 +378,13 @@ Perl_sharedsv_associate(pTHX_ SV **psv, SV *ssv, shared_sv *data) &sharedsv_scalar_vtbl, (char *)data, 0); mg->mg_flags |= (MGf_COPY|MGf_DUP); SvREFCNT_inc(ssv); + if(SvOBJECT(ssv)) { + STRLEN len; + char* stash_ptr = SvPV((SV*) SvSTASH(ssv), len); + HV* stash = gv_stashpvn(stash_ptr, len, TRUE); + SvOBJECT_on(sv); + SvSTASH_set(sv, (HV*)SvREFCNT_inc(stash)); + } } break; }