Skip to content

Commit

Permalink
Merge pull request #1094 from KJTsanaktsidis/ktsanaktsidis/missing_wb…
Browse files Browse the repository at this point in the history
…_struct_layout

Add missing write barriers to StructLayout#initialize
  • Loading branch information
larskanis committed Apr 22, 2024
2 parents 4b928c7 + 6341c34 commit 9a23686
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ext/ffi_c/StructLayout.c
Expand Up @@ -488,13 +488,13 @@ struct_layout_initialize(VALUE self, VALUE fields, VALUE size, VALUE align)

TypedData_Get_Struct(self, StructLayout, &rbffi_struct_layout_data_type, layout);
layout->fieldCount = (int) RARRAY_LEN(fields);
layout->rbFieldMap = rb_hash_new();
layout->rbFieldNames = rb_ary_new2(layout->fieldCount);
RB_OBJ_WRITE(self, &layout->rbFieldMap, rb_hash_new());
RB_OBJ_WRITE(self, &layout->rbFieldNames, rb_ary_new2(layout->fieldCount));
layout->size = (int) FFI_ALIGN(NUM2INT(size), NUM2INT(align));
layout->align = NUM2INT(align);
layout->fields = xcalloc(layout->fieldCount, sizeof(StructField *));
layout->ffiTypes = xcalloc(layout->fieldCount + 1, sizeof(ffi_type *));
layout->rbFields = rb_ary_new2(layout->fieldCount);
RB_OBJ_WRITE(self, &layout->rbFields, rb_ary_new2(layout->fieldCount));
layout->referenceFieldCount = 0;
layout->base.ffiType->elements = layout->ffiTypes;
layout->base.ffiType->size = layout->size;
Expand Down

0 comments on commit 9a23686

Please sign in to comment.