From 9726736006b3f74635fd8af05814fe0908e2cf84 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 6 Jan 2023 16:18:29 -0500 Subject: Set STR_SHARED_ROOT flag on root of string --- string.c | 1 + 1 file changed, 1 insertion(+) (limited to 'string.c') diff --git a/string.c b/string.c index 9fa482dbc7..6a62647820 100644 --- a/string.c +++ b/string.c @@ -1787,6 +1787,7 @@ str_duplicate_setup(VALUE klass, VALUE str, VALUE dup) else { RSTRING(dup)->as.heap.len = RSTRING_LEN(str); RSTRING(dup)->as.heap.ptr = RSTRING_PTR(str); + FL_SET(root, STR_SHARED_ROOT); RB_OBJ_WRITE(dup, &RSTRING(dup)->as.heap.aux.shared, root); flags |= RSTRING_NOEMBED | STR_SHARED; } -- cgit v1.2.1