Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing write barriers to StructLayout#initialize #1094

Merged

Conversation

KJTsanaktsidis
Copy link
Contributor

When setting fields on layout in struct_layout_initialize which contain Ruby VALUEs, we must do so through the RB_OBJ_WRITE macro because it the class is declared as write-barrier protected.

Fixes #1079

When setting fields on layout in struct_layout_initialize which
contain Ruby VALUEs, we must do so through the RB_OBJ_WRITE macro
because it the class is declared as write-barrier protected.
@JasonLunn
Copy link

Do the other uses of rb_hash_new and rb_ary_new2 throughout the gem need similar handling? Are there any other object initialization calls that to be on the lookout for?

@KJTsanaktsidis
Copy link
Contributor Author

Do the other uses of rb_hash_new and rb_ary_new2 throughout the gem need similar handling? Are there any other object initialization calls that to be on the lookout for?

This may well be the case - I was planning to do a more thorough pass over the weekend hopefully

@larskanis larskanis merged commit 9a23686 into ffi:master Apr 22, 2024
82 checks passed
@larskanis
Copy link
Member

Thank you for your investigation and the patch! For completeness I added RB_WRITE_OBJ also to the Qnil assignments above in commit d006232.

@JasonLunn
Copy link

Thanks, all!

@larskanis - can you release an updated release candidate to RubyGems?

@larskanis
Copy link
Member

ffi-1.17.0.rc2 is released.

@JasonLunn
Copy link

Things seem like they're significantly improved! I no longer see the same error in #1079.

Will there be an RC3, or will the next release be 1.17.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash with [BUG] try to mark T_NONE object from 3.3.0/gems/ffi-1.16.3/lib/ffi/struct_layout_builder.rb:171
3 participants