Skip to content

Commit dba1d88

Browse files
committed
generator.c: trigger write barriers in cState_init_copy
Reported-By: Yuhang Wu <yuhang@depthfirst.com>
1 parent e8800cb commit dba1d88

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

ext/json/ext/generator/generator.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,12 +1367,14 @@ static VALUE cState_init_copy(VALUE obj, VALUE orig)
13671367
if (!objState) rb_raise(rb_eArgError, "unallocated JSON::State");
13681368

13691369
MEMCPY(objState, origState, JSON_Generator_State, 1);
1370-
objState->indent = origState->indent;
1371-
objState->space = origState->space;
1372-
objState->space_before = origState->space_before;
1373-
objState->object_nl = origState->object_nl;
1374-
objState->array_nl = origState->array_nl;
1375-
objState->as_json = origState->as_json;
1370+
1371+
RB_OBJ_WRITTEN(obj, Qundef, objState->indent);
1372+
RB_OBJ_WRITTEN(obj, Qundef, objState->space);
1373+
RB_OBJ_WRITTEN(obj, Qundef, objState->space_before);
1374+
RB_OBJ_WRITTEN(obj, Qundef, objState->object_nl);
1375+
RB_OBJ_WRITTEN(obj, Qundef, objState->array_nl);
1376+
RB_OBJ_WRITTEN(obj, Qundef, objState->as_json);
1377+
13761378
return obj;
13771379
}
13781380

0 commit comments

Comments
 (0)