Use STR_SET_SHARED in str_duplicate_setup_heap

str_duplicate_setup_heap is missing a call to rb_gc_register_pinning_obj
that STR_SET_SHARED correctly calls.
This commit is contained in:
Peter Zhu 2025-12-31 15:41:47 -05:00
parent ea05c23ee8
commit 4129256214
Notes: git 2026-01-01 02:57:28 +00:00

View File

@ -1960,8 +1960,8 @@ str_duplicate_setup_heap(VALUE klass, VALUE str, VALUE dup)
RUBY_ASSERT(RB_OBJ_FROZEN_RAW(root));
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);
FL_SET_RAW(dup, RSTRING_NOEMBED);
STR_SET_SHARED(dup, root);
flags |= RSTRING_NOEMBED | STR_SHARED;
STR_SET_LEN(dup, RSTRING_LEN(str));