summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-11-20 17:52:13 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-11-20 17:58:57 -0800
commitfef5350ad7ccf261f50ed1b6cb771ee5bb4f6ade (patch)
treeb13f53fbb291f8e98fb1086d3443d199cd46d2e8 /sv.c
parentac55090a985ffce20a3f39ce0344fd33448dfdb9 (diff)
downloadperl-fef5350ad7ccf261f50ed1b6cb771ee5bb4f6ade.tar.gz
[perl #115830] Fix crash by not copying DESTROY cache
See commits 8c34e50dc and 7cc6787e9db (the latter was reverted by 95f9781bc). If we are going to store a DESTROY cache in SvSTASH when !SvOBJECT, we have to make sure not to copy that cache, otherwise other threads will try to call a CV in the first thread, resulting in a crash. 8c34e50dc introduced this bug, but the crash didn’t start happening until 7cc6787e9db, and only on Windows.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index 5447ac6bab..9f5c157a87 100644
--- a/sv.c
+++ b/sv.c
@@ -12002,6 +12002,7 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
SvMAGIC_set(dstr, mg_dup(SvMAGIC(dstr), param));
if (SvSTASH(dstr))
SvSTASH_set(dstr, hv_dup_inc(SvSTASH(dstr), param));
+ else SvSTASH_set(dstr, 0); /* don't copy DESTROY cache */
}
/* The cast silences a GCC warning about unhandled types. */