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

Move rb_global_variable #952

Merged
merged 1 commit into from
Mar 31, 2022
Merged

Move rb_global_variable #952

merged 1 commit into from
Mar 31, 2022

Conversation

soutaro
Copy link
Member

@soutaro soutaro commented Mar 31, 2022

Trying to fix random test failure:

/__w/rbs/rbs/lib/rbs/parser_aux.rb:12:in `gsub!': no implicit conversion of Array into String (TypeError)
	from /__w/rbs/rbs/lib/rbs/parser_aux.rb:12:in `_parse_signature'
	from /__w/rbs/rbs/lib/rbs/parser_aux.rb:12:in `parse_signature'

@soutaro soutaro merged commit a772be0 into master Mar 31, 2022
@soutaro soutaro deleted the rb_global_variable branch March 31, 2022 12:01
@@ -19,6 +19,7 @@ void rbs_unescape_string(VALUE string) {

if (!HASH) {
HASH = rb_hash_new();
rb_global_variable(&HASH);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GC may be started from inside rb_str_new_literal call where the HASH is not placed on the stack. It means the value of HASH may be freed before the execution of rb_global_variable at the lsat place.

So, moving the rb_global_variable here will ensure it is marked before any possible GC start. 💪

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

Successfully merging this pull request may close these issues.

1 participant