develooper Front page | perl.perl5.porters | Postings from December 2009

[PATCH 2/3] when removing magic, fix SvMAGICAL flags (unlesssave_magic is active)

From:
Chip Salzenberg
Date:
December 5, 2009 21:28
Subject:
[PATCH 2/3] when removing magic, fix SvMAGICAL flags (unlesssave_magic is active)
Message ID:
E1NH9fm-0000zW-Eo@tytlal
---
 sv.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

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;
 }
 
-- 
1.6.5.4




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About