SvREADONLY_off inside the magic routines is also dangerous on shared
Nicholas Clark [Thu, 26 Jan 2006 14:57:42 +0000 (14:57 +0000)]
hash key scalars, so decompose them to normal scalars if they ever
get here.

p4raw-id: //depot/perl@26946

mg.c

diff --git a/mg.c b/mg.c
index a85cc46..1521241 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -86,11 +86,10 @@ S_save_magic(pTHX_ I32 mgs_ix, SV *sv)
     dVAR;
     MGS* mgs;
     assert(SvMAGICAL(sv));
-#ifdef PERL_OLD_COPY_ON_WRITE
-    /* Turning READONLY off for a copy-on-write scalar is a bad idea.  */
+    /* Turning READONLY off for a copy-on-write scalar (including shared
+       hash keys) is a bad idea.  */
     if (SvIsCOW(sv))
       sv_force_normal_flags(sv, 0);
-#endif
 
     SAVEDESTRUCTOR_X(S_restore_magic, INT2PTR(void*, (IV)mgs_ix));