From 317ec34c4f2f5d6276d12392ee09cb99461cefd0 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Thu, 29 Jul 2010 13:23:22 +0100 Subject: [PATCH] Revert "make it an error to look for magic hv backref" This reverts commit 64345bb5cdba725a5e2af06c99aa36d8a1b8b873. --- sv.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sv.c b/sv.c index b2383fd..c762357 100644 --- a/sv.c +++ b/sv.c @@ -5373,16 +5373,14 @@ Perl_sv_del_backref(pTHX_ SV *const tsv, SV *const sv) PERL_ARGS_ASSERT_SV_DEL_BACKREF; - if (SvTYPE(tsv) == SVt_PVHV) { - if (SvOOK(tsv)) { - /* SvOOK: We must avoid creating the hv_aux structure if its - * not already there, as that is stored in the main HvARRAY(), - * and hfreentries assumes that no-one reallocates HvARRAY() - * while it is running. */ - av = *Perl_hv_backreferences_p(aTHX_ MUTABLE_HV(tsv)); - } - } - else { + if (SvTYPE(tsv) == SVt_PVHV && SvOOK(tsv)) { + av = *Perl_hv_backreferences_p(aTHX_ MUTABLE_HV(tsv)); + /* We mustn't attempt to "fix up" the hash here by moving the + backreference array back to the hv_aux structure, as that is stored + in the main HvARRAY(), and hfreentries assumes that no-one + reallocates HvARRAY() while it is running. */ + } + if (!av) { const MAGIC *const mg = SvMAGICAL(tsv) ? mg_find(tsv, PERL_MAGIC_backref) : NULL; if (mg) -- 1.8.3.1