This is a live mirror of the Perl 5 development currently hosted at
[perl #115830] Fix crash by not copying DESTROY cache
authorFather Chrysostomos <>
Wed, 21 Nov 2012 01:52:13 +0000 (17:52 -0800)
committerFather Chrysostomos <>
Wed, 21 Nov 2012 01:58:57 +0000 (17:58 -0800)
See commits 8c34e50dc and 7cc6787e9db (the latter was reverted by

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.


diff --git a/sv.c b/sv.c
index 5447ac6..9f5c157 100644 (file)
--- 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.  */