diff options
author | David Mitchell <davem@iabyn.com> | 2010-07-05 21:11:21 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-07-14 23:06:17 +0100 |
commit | 64345bb5cdba725a5e2af06c99aa36d8a1b8b873 (patch) | |
tree | 363bed771e414e8bbd3c6f62fe475627c90824c1 /sv.c | |
parent | 4c74a7df3242aa95d62dcfbcc231b8a55cc03c59 (diff) | |
download | perl-64345bb5cdba725a5e2af06c99aa36d8a1b8b873.tar.gz |
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.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -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) |