Re: Changes in KVO behavior on SL?

2009-09-02 Thread Derek Chesterfield


On 2 Sep 2009, at 13:47, Kevin Brock wrote:

Likewise, there's never been any guarantee that invoking - 
observeValueForKeyPath:ofObject:change:context: will provoke the  
receiver to call -valueForKeyPath: on the object whose property has  
changed.  If the observer wants, it can rely totally on the  
information in the change dictionary.  If you were using will/ 
didChange..., then KVO can be expected to invoke valueForKey: on  
the object whose property is changing, but that's not what (you  
say) you're doing.


Thanks.  That was helpful.  On 10.5 the receiver *does* apparently  
always call valueForKeyPath, at least with the receivers we're  
talking to.  Maybe they weren't checking the dictionary on 10.5, or  
were calling the fn if the data on the new values wasn't found in  
the dictionary, but are being stricter on 10.6.


Ken didn't contradict the behaviour you have observed. But you are  
[were] relying on a mechanism that is undocumented and quite possibly  
accidental on the part of Apple's engineers, and so could have changed  
at any time, or might have been erratic/fragile even on 10.5.


In other words, it is merely fortunate that your app ever worked on  
10.5, and not by design  ;-)
The documented pattern that Ken described should work on both 10.5 and  
10.6, and will always work... until deprecated anyway!

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Changes in KVO behavior on SL?

2009-09-02 Thread Kevin Brock


On Sep 1, 2009, at 6:11 PM, Ken Thomases wrote:


On Sep 1, 2009, at 7:14 PM, Kevin Brock wrote:

We've got an app that is using keyValueForPath: and  
observeValueForKeyPath:ofObject:change:context: to keep a status  
window up-to-date.


On 10.5 it works fine.  On 10.6 keyValueForPath: is called exactly  
once per property.  When we later create a change dictionary and  
send observeValueForKeyPath:ofObject:change:context: to the  
observer for a property, valueForKeyPath: isn't called again.


Huh?  You have never been supposed to call - 
observeValueForKeyPath:ofObject:change:context: yourself, nor  
construct change dictionaries.  When a property changes in a way  
that KVO can't automatically track, you are supposed to call -will/ 
didChangeValueForKey: (or the corresponding will/didChange...  
methods for set or array mutation) and KVO will generate the change  
notification itself.


Good to know.   I'll give that a try.  Lot of legacy code in that part  
of the app--I doubt that this is the last thing I'll run into.


Likewise, there's never been any guarantee that invoking - 
observeValueForKeyPath:ofObject:change:context: will provoke the  
receiver to call -valueForKeyPath: on the object whose property has  
changed.  If the observer wants, it can rely totally on the  
information in the change dictionary.  If you were using will/ 
didChange..., then KVO can be expected to invoke valueForKey: on the  
object whose property is changing, but that's not what (you say)  
you're doing.


Thanks.  That was helpful.  On 10.5 the receiver *does* apparently  
always call valueForKeyPath, at least with the receivers we're talking  
to.  Maybe they weren't checking the dictionary on 10.5, or were  
calling the fn if the data on the new values wasn't found in the  
dictionary, but are being stricter on 10.6.


Kevin


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Changes in KVO behavior on SL?

2009-09-01 Thread Ken Thomases

On Sep 1, 2009, at 7:14 PM, Kevin Brock wrote:

We've got an app that is using keyValueForPath: and  
observeValueForKeyPath:ofObject:change:context: to keep a status  
window up-to-date.


On 10.5 it works fine.  On 10.6 keyValueForPath: is called exactly  
once per property.  When we later create a change dictionary and  
send observeValueForKeyPath:ofObject:change:context: to the observer  
for a property, valueForKeyPath: isn't called again.


Huh?  You have never been supposed to call - 
observeValueForKeyPath:ofObject:change:context: yourself, nor  
construct change dictionaries.  When a property changes in a way that  
KVO can't automatically track, you are supposed to call -will/ 
didChangeValueForKey: (or the corresponding will/didChange... methods  
for set or array mutation) and KVO will generate the change  
notification itself.


Likewise, there's never been any guarantee that invoking - 
observeValueForKeyPath:ofObject:change:context: will provoke the  
receiver to call -valueForKeyPath: on the object whose property has  
changed.  If the observer wants, it can rely totally on the  
information in the change dictionary.  If you were using will/ 
didChange..., then KVO can be expected to invoke valueForKey: on the  
object whose property is changing, but that's not what (you say)  
you're doing.


Regards,
Ken

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Changes in KVO behavior on SL?

2009-09-01 Thread Kyle Sluder
On Tue, Sep 1, 2009 at 5:14 PM, Kevin Brock wrote:
> We've got an app that is using keyValueForPath: and
> observeValueForKeyPath:ofObject:change:context: to keep a status window
> up-to-date.

It's valueForKeyPath:.

> On 10.5 it works fine.  On 10.6 keyValueForPath: is called exactly once per
> property.  When we later create a change dictionary and send
> observeValueForKeyPath:ofObject:change:context: to the observer for a
> property, valueForKeyPath: isn't called again.

You need to post your code.

> Is there a known change in 10.6 to how these functions are supposed to work?
>  It's really odd, because all of our low-level code, including some  KEXTs,
>  works fine in 32 bit SL, but this one piece doesn't...

There are changes -- read the release notes.  None of them should
introduce the behavior you're seeing.

--Kyle Sluder
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Changes in KVO behavior on SL?

2009-09-01 Thread Kevin Brock
We've got an app that is using keyValueForPath: and 
observeValueForKeyPath:ofObject:change:context: to keep a status window 
up-to-date.


On 10.5 it works fine.  On 10.6 keyValueForPath: is called exactly once 
per property.  When we later create a change dictionary and send 
observeValueForKeyPath:ofObject:change:context: to the observer for a 
property, valueForKeyPath: isn't called again.


Is there a known change in 10.6 to how these functions are supposed to 
work?  It's really odd, because all of our low-level code, including 
some  KEXTs,  works fine in 32 bit SL, but this one piece doesn't...



Kevin


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com