diff options
author | Vincent Pit <perl@profvince.com> | 2008-03-12 18:37:40 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-05-02 11:44:25 +0000 |
commit | 90630e3c741716305d7f1da4df5eab5c1bee42cc (patch) | |
tree | 9c89ca87578de9737a81b88f7f50473909336e32 /pp_hot.c | |
parent | e67b97bd974194ad616acbb7813c5631aacd6be7 (diff) | |
download | perl-90630e3c741716305d7f1da4df5eab5c1bee42cc.tar.gz |
Re: [perl #51636] segmentation fault with array ties
From: "Vincent Pit" <perl@profvince.com>
Message-ID: <56287.147.210.17.175.1205339860.squirrel@147.210.17.175>
p4raw-id: //depot/perl@33778
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -1020,8 +1020,14 @@ PP(pp_aassign) *(relem++) = sv; didstore = av_store(ary,i++,sv); if (magic) { - if (SvSMAGICAL(sv)) + if (SvSMAGICAL(sv)) { + /* More magic can happen in the mg_set callback, so we + * backup the delaymagic for now. */ + U16 dmbak = PL_delaymagic; + PL_delaymagic = 0; mg_set(sv); + PL_delaymagic = dmbak; + } if (!didstore) sv_2mortal(sv); } @@ -1051,8 +1057,12 @@ PP(pp_aassign) duplicates += 2; didstore = hv_store_ent(hash,sv,tmpstr,0); if (magic) { - if (SvSMAGICAL(tmpstr)) + if (SvSMAGICAL(tmpstr)) { + U16 dmbak = PL_delaymagic; + PL_delaymagic = 0; mg_set(tmpstr); + PL_delaymagic = dmbak; + } if (!didstore) sv_2mortal(tmpstr); } @@ -1076,7 +1086,13 @@ PP(pp_aassign) } else sv_setsv(sv, &PL_sv_undef); - SvSETMAGIC(sv); + + if (SvSMAGICAL(sv)) { + U16 dmbak = PL_delaymagic; + PL_delaymagic = 0; + mg_set(sv); + PL_delaymagic = dmbak; + } break; } } |