summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@pobox.com>2009-10-26 19:39:20 -0700
committerChip Salzenberg <chip@pobox.com>2009-12-05 20:36:36 -0800
commit806e7ca7a95b2271bcd698a87bd05a4b9ea9ae68 (patch)
tree7aa136f5ffc05674f65735e1fd7e1d27b6e9fa58 /sv.c
parentf9c6fee519b868a2e8ef8c5b701c0d3f95565423 (diff)
downloadperl-806e7ca7a95b2271bcd698a87bd05a4b9ea9ae68.tar.gz
when removing magic, fix SvMAGICAL flags (unless save_magic is active)
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sv.c b/sv.c
index 95ad106cec..811d8ce53c 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;
}