From f78fcf1010ce62cd4c52d124bd283fa398f5a9f1 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Tue, 15 May 2012 16:24:31 +0000 Subject: [PATCH] * ext/psych/lib/psych/visitors/yaml_tree.rb: keep a reference to custom coders so that GC does not impact dumped yaml reference ids. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/psych/lib/psych/visitors/yaml_tree.rb | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 47927d981c7dbd..326a3597eb43e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed May 16 01:15:45 2012 Aaron Patterson + + * ext/psych/lib/psych/visitors/yaml_tree.rb: keep a reference to + custom coders so that GC does not impact dumped yaml reference ids. + Tue May 15 23:59:48 2012 Nobuyoshi Nakada * lib/test/unit.rb (Test::Unit::Options#setup_options): add --color option. diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 80af0466eba56a..646fed71aa8148 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -20,6 +20,7 @@ def initialize options = {}, emitter = TreeBuilder.new, ss = ScalarScanner.new @st = {} @ss = ss @options = options + @coders = [] @dispatch_cache = Hash.new do |h,klass| method = "visit_#{(klass.name || '').split('::').join('_')}" @@ -406,6 +407,7 @@ def register target, yaml_obj end def dump_coder o + @coders << o tag = Psych.dump_tags[o.class] unless tag klass = o.class == Object ? nil : o.class.name