Very simple setup in a test project. I have an array controller with content 
bound to App Delegate's "objects" array, and I have a slider control bound to 
the controller's selection.value. I set App Delegate's objects array to an 
array with an NSString in it. So the NSString *does not respond* to value, so 
normally this would raise an exception. If you turn off Raises For Not 
Applicable Keys on the slider's Value binding, then the application leaks an 
NSString from within valueForKeyPath:. 


http://www.sethwillits.com/temp/BindingRaiseLeak.zip
http://sethwillits.com/temp/upshot/upshot_xMuBExbD.jpg

It leaks for each binding with the setting turned off, each time the selection 
changes.


--

Note that any NSObjectController will do, it's not just NSArrayController. 
Also, the leaked string is the binding's controller key value "selection". 

I would just file this and move on, except I'm planning to rely a lot on 
setting NSRaisesForNotApplicableKeysBindingOption to NO so that it will 
automatically disable controls which are for editing properties that one or 
more objects in the array controller's selection don't support. I'm not sure 
how else I can accomplish this easily while avoiding the leak.

It does seem I can implement a getter for every key and return 
NSNotApplicableMarker, and that appropriately disables the control and doesn't 
leak. valueForKeyPath: nor valueForUndefinedKey: is called on the instances so 
I can't try it in one spot there.



Thoughts? Will radar it if I'm not missing something.


--
Seth Willits




_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to