[MacRuby-devel] [MacRuby] #387: inspect with circular references crashes

MacRuby ruby-noreply at macosforge.org
Thu Oct 15 08:23:30 PDT 2009


#387: inspect with circular references crashes
----------------------------+-----------------------------------------------
 Reporter:  jazzbox@…       |       Owner:  lsansonetti@…        
     Type:  defect          |      Status:  new                  
 Priority:  major           |   Milestone:  MacRuby 0.5          
Component:  MacRuby         |    Keywords:                       
----------------------------+-----------------------------------------------
 {{{
 $ cat insp.rb

 class Foo
   def initialize bar
     @bar = bar
   end
 end

 class Bar
   def initialize
     @foo = Foo.new(self)
     #@bar = self  # this crashes too
   end
 end

 puts Bar.new.inspect
 }}}

 {{{
 $ macruby insp.rb
 Segmentation fault
 }}}


 {{{
 $ ruby insp.rb
 #<Bar:0x1001561d8 @foo=#<Foo:0x100156110 @bar=#<Bar:0x1001561d8 ...>>>
 }}}


 (BTW, this was a very hard one to find for me: Foreign code, multiple
 nested modules and many, many instance variables. First I thought it has
 to too witch complexity until I had the idea with the circular
 reference...)

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/387>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list