From: Chip Salzenberg Date: Tue, 27 Oct 2009 02:39:20 +0000 (-0700) Subject: when removing magic, fix SvMAGICAL flags (unless save_magic is active) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=806e7ca7a95b2271bcd698a87bd05a4b9ea9ae68;p=p5sagit%2Fp5-mst-13.2.git when removing magic, fix SvMAGICAL flags (unless save_magic is active) --- diff --git a/sv.c b/sv.c index 95ad106..811d8ce 100644 --- a/sv.c +++ b/sv.c @@ -5209,12 +5209,14 @@ Perl_sv_unmagic(pTHX_ SV *const sv, const int type) else mgp = &mg->mg_moremagic; } - if (!SvMAGIC(sv)) { + if (SvMAGIC(sv)) { + if (SvMAGICAL(sv)) /* if we're under save_magic, wait for restore_magic; */ + mg_magical(sv); /* else fix the flags now */ + } + else { SvMAGICAL_off(sv); SvFLAGS(sv) |= (SvFLAGS(sv) & (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT; - SvMAGIC_set(sv, NULL); } - return 0; }