Author: chromatic
Date: Tue Jun 12 01:10:27 2007
New Revision: 18943

Modified:
   trunk/src/string.c

Log:
[String] When making a COW reference of a constant string, clear the "I'm a 
constant!" flag from the destination if you allocate it from a non-constant 
pool.

Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c  (original)
+++ trunk/src/string.c  Tue Jun 12 01:10:27 2007
@@ -127,13 +127,14 @@
         return NULL;
 
     if (PObj_constant_TEST(s)) {
-        d = new_string_header(interp, 0);
+        d = new_string_header(interp, PObj_get_FLAGS(s) & ~PObj_constant_FLAG);
         PObj_COW_SET(s);
         copy_string_header(d, s);
         /* we can't move the memory, because constants aren't
          * scanned in compact_pool, therefore the other end
          * would point to garbage.
          */
+        PObj_constant_CLEAR(d);
         PObj_external_SET(d);
     }
     else {

Reply via email to