[前][次][番号順一覧][スレッド一覧]

ruby-changes:23604

From: tenderlove <ko1@a...>
Date: Wed, 16 May 2012 01:24:40 +0900 (JST)
Subject: [ruby-changes:23604] tenderlove:r35655 (trunk): * ext/psych/lib/psych/visitors/yaml_tree.rb: keep a reference to

tenderlove	2012-05-16 01:24:31 +0900 (Wed, 16 May 2012)

  New Revision: 35655

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35655

  Log:
    * ext/psych/lib/psych/visitors/yaml_tree.rb: keep a reference to
      custom coders so that GC does not impact dumped yaml reference ids.

  Modified files:
    trunk/ChangeLog
    trunk/ext/psych/lib/psych/visitors/yaml_tree.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35654)
+++ ChangeLog	(revision 35655)
@@ -1,3 +1,8 @@
+Wed May 16 01:15:45 2012  Aaron Patterson <aaron@t...>
+
+	* 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  <nobu@r...>
 
 	* lib/test/unit.rb (Test::Unit::Options#setup_options): add --color option.
Index: ext/psych/lib/psych/visitors/yaml_tree.rb
===================================================================
--- ext/psych/lib/psych/visitors/yaml_tree.rb	(revision 35654)
+++ ext/psych/lib/psych/visitors/yaml_tree.rb	(revision 35655)
@@ -20,6 +20,7 @@
         @st       = {}
         @ss       = ss
         @options  = options
+        @coders   = []
 
         @dispatch_cache = Hash.new do |h,klass|
           method = "visit_#{(klass.name || '').split('::').join('_')}"
@@ -406,6 +407,7 @@
       end
 
       def dump_coder o
+        @coders << o
         tag = Psych.dump_tags[o.class]
         unless tag
           klass = o.class == Object ? nil : o.class.name

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]