From: David Mitchell Date: Mon, 5 Jul 2010 20:11:21 +0000 (+0100) Subject: make it an error to look for magic hv backref X-Git-Tag: v5.13.3~92 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/64345bb5cdba725a5e2af06c99aa36d8a1b8b873 make it an error to look for magic hv backref Now that we only store a stash's backref AV in xhv_backreferences, make it a panic if we don't find it there, rather than falling back to look for backref magic. --- diff --git a/sv.c b/sv.c index c841dc9..4ca7333 100644 --- a/sv.c +++ b/sv.c @@ -5373,14 +5373,16 @@ Perl_sv_del_backref(pTHX_ SV *const tsv, SV *const sv) PERL_ARGS_ASSERT_SV_DEL_BACKREF; - 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) { + 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 { const MAGIC *const mg = SvMAGICAL(tsv) ? mg_find(tsv, PERL_MAGIC_backref) : NULL; if (mg)