[MacRuby-devel] [MacRuby] #269: Calling a method on a pointer passed to a KVC validation method fails

MacRuby ruby-noreply at macosforge.org
Fri May 29 08:16:08 PDT 2009


#269: Calling a method on a pointer passed to a KVC validation method fails
--------------------------------+-------------------------------------------
 Reporter:  mikael@…            |       Owner:  lsansonetti@…        
     Type:  defect              |      Status:  new                  
 Priority:  major               |   Milestone:                       
Component:  MacRuby             |    Keywords:  kvc pointer crash    
--------------------------------+-------------------------------------------
 If I define a -validate<Key>:error: method in the class used as an
 NSArrayController's class, any method call on any parameter causes a
 crash.

 == Steps to reproduce: ==

 Create a new MacRuby project.
 Place a table view and a button in the main window.
 Instantiate a new NSArrayController.
 Set the class of the array controller to SomeModel, with the key someKey.
 Bind the table view's single column's value to the array controller's
 arrangedObject.someKey key path, and check Validates Immediately.
 Set the button's target to be the array controller, action add:.

 Create a new Ruby file in the project. Here's the code:

 {{{
 #encoding: utf-8
 class SomeModel
   attr_accessor :someKey

   def validateSomeKey someKeyPointer, error: errorPointer
     NSLog "Validating someKey."
     someKeyPointer.nil? # This is where the program crashes.
     return true
   end
 end
 }}}

 Launch the application, add a new row, try to change its someKey. When you
 press enter, it crashes.

 Attached is the backtrace I get from GDB.

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



More information about the MacRuby-devel mailing list