[MacRuby] #1343: autotest-fsevent AND autotest-growl causes SegFault

MacRuby ruby-noreply at macosforge.org
Tue Jul 5 10:52:22 PDT 2011


#1343: autotest-fsevent AND autotest-growl causes SegFault
-----------------------------+----------------------------------------------
 Reporter:  kykim@…          |       Owner:  lsansonetti@…        
     Type:  defect           |      Status:  new                  
 Priority:  blocker          |   Milestone:                       
Component:  MacRuby          |    Keywords:                       
-----------------------------+----------------------------------------------

Comment(by kykim@…):

 I *think* I've figured out the code that is causing the problem...
 If not, it's causing *a* problem.  This is a simplification of the
 autotest gem code, btw.

 {{{
 require 'rubygems'
 require 'sys/uname'


 class TestHooks
   HOOKS = { :something => [], :nothing => [] }

   def self.add_hook(name, &block)
     HOOKS[name] << block
   end

   def hook(name, &args)
     HOOKS[name].any?{ |hook| hook[self, *args] }
   end

   def do_something
     puts "doing something"
   end
 end

 th = TestHooks.new

 puts TestHooks::HOOKS.inspect
 th.do_something

 TestHooks.add_hook :something do
   if Sys::Uname.sysname == 'Darwin' && Sys::Uname.release.to_i >= 9
     class ::TestHooks
       remove_method :do_something
       def do_something
         hook :nothing
         begin
           puts "doing something else"
         end
       end
     end
   else
     puts "wrong OS and/or version"
   end
 end
 puts TestHooks::HOOKS.inspect

 th.hook(:something)
 th.do_something

 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1343#comment:4>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list