KVO dot notation bug?
I may have come across a KVO-related bug in MacRuby. In my project I have an Objective-C subclass of NSObject that uses @property and @synthesize to set up instance variable accessors. In the init method I set a key-value observer for one of those variables ('text') using: [self addObserver:self forKeyPath:@"text" options:NSKeyValueObservingOptionNew context:NULL]; The class also has the required observing method: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context When I set a new value for 'text' from Objective-C code using something like instance.text = @"Hello", the observing method is called as expected and everything is fine. When I set a new value from MacRuby code using instance.setText("Hello"), it also works fine. However, when I set a new value from MacRuby code using dot notation, e.g. instance.text = "Hello", it fails and the debugger is activated. The error log is lengthy, but it begins with these statements: warning: Could not find object file "/private/tmp/trunk/array.o" - no debug information available for "array.c". warning: Could not find object file "/private/tmp/trunk/bignum.o" - no debug information available for "bignum.c". Assigning values to the other instance variables of the Obj-C class works fine from MacRuby using dot notation, but those other variables do not have observers assigned. In fact, if I remove the 'observeValue...' method from the Obj-C class, the dot notation assignment works fine again for that 'text' variable. Sure seems like a bug to me. Any ideas? Jim
participants (2)
-
Benjamin Stiglitz
-
Jim Getzen