#374: Adding a binding (in IB) prevents instance variables -------------------------------------+-------------------------------------- Reporter: parzi...@… | Owner: lsansone...@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: -------------------------------------+-------------------------------------- I've got a (MacRuby) subclass of NSWindowController. If a binding is added using Interface Builder, it becomes impossible to have any instance variables in my subclass. What's kind of strange, too, is that removing the binding doesn't fix it; so far it seems necessary to delete the object in IB and then re-create it.
I'm using r2771, on a MBP(2007) running 10.6.1. This was working at some point in 0.4, but I think it's been broken for at least a couple weeks or more. Here's some code in my class to demonstrate. This gets called in awakeFromNib, though I tried adding an instance variable in initWithWindow and it came back nil as well : {{{ testSPC = SourcePaneController.new puts "testSPC:" p testSPC @testSPC_iv = SourcePaneController.new puts "@testSPC_iv:" p @testSPC_iv testInt = 3 puts "testInt:" p testInt @testInt_iv = 5 puts "@testInt_iv:" p @testInt puts "Instance variables are :" p self.instance_variables }}} And the output: {{{ in MainWinController.initWithWindow in SourcePaneController.init testSPC: #<SourcePaneController:0x2003df0a0> in SourcePaneController.init @testSPC_iv: nil testInt: 3 @testInt_iv: nil Instance variables are : [] }}} As can be seen, the calls to my other class's initializer are working, but it's not getting assigned to the instance variable. A potentially revealing error occurred when I mistyped one of my test variable names. This is what happens after ' @testSPC_iv = nothing' (where 'nothing' is an unassigned variable) : {{{ 2009-10-09 12:22:01.975 resynch[1015:a0f] +[MainWinController _getValue:forKey:]: unrecognized selector sent to class 0x200238940 2009-10-09 12:22:01.978 resynch[1015:a0f] +[MainWinController _getValue:forKey:]: unrecognized selector sent to class 0x200238940 2009-10-09 12:22:01.979 resynch[1015:a0f] An uncaught exception was raised 2009-10-09 12:22:01.979 resynch[1015:a0f] +[MainWinController _getValue:forKey:]: unrecognized selector sent to class 0x200238940 2009-10-09 12:22:01.981 resynch[1015:a0f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[MainWinController _getValue:forKey:]: unrecognized selector sent to class 0x200238940' *** Call stack at first throw: ( 0 CoreFoundation 0x00007fff83dbf5a4 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x00007fff87c7c313 objc_exception_throw + 45 2 CoreFoundation 0x00007fff83e18330 __CFFullMethodName + 0 3 CoreFoundation 0x00007fff83d9230f ___forwarding___ + 751 4 CoreFoundation 0x00007fff83d8e458 _CF_forwarding_prep_0 + 232 5 CoreFoundation 0x00007fff83d53ffd CFDictionaryGetValueIfPresent + 93 6 libmacruby.dylib 0x000000010010b4ee classname + 126 7 libmacruby.dylib 0x000000010010b728 rb_class_path + 24 8 libmacruby.dylib 0x000000010010ba3e rb_obj_classname + 46 9 libmacruby.dylib 0x000000010006f89f rb_any_to_string + 15 10 libmacruby.dylib 0x000000010015f697 rb_vm_call_with_cache2 + 4663 11 libmacruby.dylib 0x0000000100121199 rb_funcall + 425 12 libmacruby.dylib 0x000000010015f697 rb_vm_call_with_cache2 + 4663 13 libmacruby.dylib 0x0000000100121199 rb_funcall + 425 14 libmacruby.dylib 0x000000010006a8f6 rb_inspect + 22 15 libmacruby.dylib 0x000000010003e2a1 name_err_mesg_to_str + 161 16 libmacruby.dylib 0x0000000100162d6f rb_vm_call + 4783 17 libmacruby.dylib 0x0000000100070df9 rb_convert_type + 121 18 libmacruby.dylib 0x00000001000f010b rb_string_value + 107 19 libmacruby.dylib 0x000000010003c62e name_err_to_s + 78 20 libmacruby.dylib 0x000000010015f697 rb_vm_call_with_cache2 + 4663 21 libmacruby.dylib 0x0000000100121199 rb_funcall + 425 22 libmacruby.dylib 0x0000000100162d6f rb_vm_call + 4783 23 libmacruby.dylib 0x0000000100175e23 rb_vm_print_current_exception + 99 24 libmacruby.dylib 0x0000000100176108 macruby_main + 392 25 resynch 0x0000000100000e3e main + 40 26 resynch 0x0000000100000ad8 start + 52 27 ??? 0x0000000000000001 0x0 + 1 ) terminate called after throwing an instance of 'NSException' Program received signal: “SIGABRT”. }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/374> MacRuby <http://macruby.org/> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel