ruby-changes:55276
From: tenderlove <ko1@a...>
Date: Wed, 10 Apr 2019 06:13:36 +0900 (JST)
Subject: [ruby-changes:55276] tenderlove:r67483 (trunk): Add error globals to mark list so they don't move
tenderlove 2019-04-10 06:13:32 +0900 (Wed, 10 Apr 2019) New Revision: 67483 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67483 Log: Add error globals to mark list so they don't move JSON gem is referencing constants defined in Ruby then keeping a reference as a global. We need to register these globals so they stay pinned. Modified files: trunk/ext/json/generator/generator.c trunk/ext/json/parser/parser.c Index: ext/json/parser/parser.c =================================================================== --- ext/json/parser/parser.c (revision 67482) +++ ext/json/parser/parser.c (revision 67483) @@ -2091,6 +2091,8 @@ void Init_parser(void) https://github.com/ruby/ruby/blob/trunk/ext/json/parser/parser.c#L2091 cParser = rb_define_class_under(mExt, "Parser", rb_cObject); eParserError = rb_path2class("JSON::ParserError"); eNestingError = rb_path2class("JSON::NestingError"); + rb_gc_register_mark_object(eParserError); + rb_gc_register_mark_object(eNestingError); rb_define_alloc_func(cParser, cJSON_parser_s_allocate); rb_define_method(cParser, "initialize", cParser_initialize, -1); rb_define_method(cParser, "parse", cParser_parse, 0); Index: ext/json/generator/generator.c =================================================================== --- ext/json/generator/generator.c (revision 67482) +++ ext/json/generator/generator.c (revision 67483) @@ -1344,6 +1344,8 @@ void Init_generator(void) https://github.com/ruby/ruby/blob/trunk/ext/json/generator/generator.c#L1344 eGeneratorError = rb_path2class("JSON::GeneratorError"); eNestingError = rb_path2class("JSON::NestingError"); + rb_gc_register_mark_object(eGeneratorError); + rb_gc_register_mark_object(eNestingError); cState = rb_define_class_under(mGenerator, "State", rb_cObject); rb_define_alloc_func(cState, cState_s_allocate); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/