On Wed, 11 Mar 2015 23:28:08 +0000, Quincey Morris said: >— I don’t think it’s a very good idea to do this (slightly abbreviated >from your source): > >> - (void)bind:(NSString*)inBindingName toObject:(id)inObservableObject >withKeyPath:(NSString*)inKeyPath options:(NSDictionary*)inOptions { >> [inObservableObject addObserver:self forKeyPath:inKeyPath options:0 >context:context]; >> [super bind:inBindingName toObject:inObservableObject >withKeyPath:inKeyPath options:inOptions]; >> } > >The standard implementation of bindings, which you’re using when you >invoke super, *also* adds the exact same observation as you just did >(though with a different or nil context, presumably). > >When you invoke super in ‘unbind', I guess it’s using the context-less >form of removeObserver.
Thanks for your analysis; I concur with it. Not using bindings isn't an option, at least not in the short/medium term. The app was started back when we had ibplugins and uses bindings heavily. Regarding your prescriptions, I was going to say 'but I'm doing it just as mmalc's old binding examples suggested' but then I went to look up the old BindingsJoystick sample code and see that it was updated in 2012, which I never noticed. I swear they changed how they do things. Now bind: and unbind: only call super if the binding name is not the class' own, and now they implement infoForbinding:. My SCM history shows that unconditionally calling super was necessary for ibplugins to work properly, which is moot now. So I guess my solution is to only call super in bind: and unbind: for binding names that aren't mine, and to also override infoForBinding: to return info for my own bindings, and again only call super for super's bindings. Thanks! -- ____________________________________________________________ Sean McBride, B. Eng s...@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com