[MacRuby-devel] [MacRuby] #402: "unrecognized selector" error if overriding Object#dup

MacRuby ruby-noreply at macosforge.org
Sat Oct 24 22:48:18 PDT 2009


#402: "unrecognized selector" error if overriding Object#dup
-------------------------------+--------------------------------------------
 Reporter:  pwilson@…          |       Owner:  lsansonetti@…        
     Type:  defect             |      Status:  new                  
 Priority:  blocker            |   Milestone:                       
Component:  MacRuby            |    Keywords:                       
-------------------------------+--------------------------------------------
 Given the following code:

 {{{
 #! /usr/bin/ruby -w

 class MyClass
   def dup
     super
   end
 end

 a = MyClass.new
 p a

 b = a.dup
 p b
 }}}

 I get this fatal exception using the Oct 24 nightly build of MacRuby:

 {{{
 2009-10-24 22:45:23.316 macruby[7029:903] -[MyClass copyWithZone:]:
 unrecognized selector sent to instance 0x2029be0
 2009-10-24 22:45:23.321 macruby[7029:903] *** Terminating app due to
 uncaught exception 'NSInvalidArgumentException', reason: '-[MyClass
 copyWithZone:]: unrecognized selector sent to instance 0x2029be0'
 *** Call stack at first throw:
 (
         0   CoreFoundation                      0x9151a40a __raiseError +
 410
         1   libobjc.A.dylib                     0x92dac509
 objc_exception_throw + 56
         2   CoreFoundation                      0x9156690b
 -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
         3   CoreFoundation                      0x914c1db6
 ___forwarding___ + 950
         4   CoreFoundation                      0x914c1982
 _CF_forwarding_prep_0 + 50
         5   CoreFoundation                      0x914ad7ea
 -[NSObject(NSObject) copy] + 42
         6   libmacruby.dylib                    0x0017ae7e rb_vm_dispatch
 + 8622
         7   ???                                 0x00e3e24b 0x0 + 14934603
         8   ???                                 0x00e3e17a 0x0 + 14934394
         9   libmacruby.dylib                    0x0004192b ruby_run_node +
 91
         10  macruby                             0x00001c98 main + 184
         11  macruby                             0x00001bd5 start + 53
         12  ???                                 0x00000002 0x0 + 2
 )
 Killed
 }}}

 The code works as expected when run with Ruby 1.8.7.  It also works
 without the overridden 'dup' method.

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



More information about the MacRuby-devel mailing list