Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KVO events are not being fired for certain float/double-type properties #501

Closed
triplef opened this issue May 17, 2016 · 1 comment
Closed

Comments

@triplef
Copy link
Contributor

triplef commented May 17, 2016

In our app, observing certain properties does not result in a KVO change notification when the property changes. This seems to affect float- and double-type properties only, although not every property of this type seems to be affected. The properties are direct, i.e. not derived from other key paths.

While we haven’t been able to track it down to a test case, here is what we found:

  • For affected properties, will/didChangeValueForKey: is called with key == null
  • Consequently, calling will/didChangeValueForKey: manually within these methods causes KVO to work for them
  • It seems that _keyFromSelector() in NSKVOSwizzling.mm is returning nil here, i.e. the associated key object is not found
  • _NSKVOEnsureKeyWillNotify() is called correctly, and the associated key object is set on the object
  • However, it seems like the selector pointer is not the same in _NSKVOEnsureKeyWillNotify() and notifyingSetImpl(), which is why the associated key object is not found.

Any ideas on how to debug this further would be appreciated.

@DHowett-MSFT
Copy link

Root caused this one: we're using objc associated objects to track selector<->key mappings.
libobjc2's association logic would only search the most shallow association table in the stack.

Therefore, when you associate more than REFERENCE_LIST_SIZE (10, at the moment) keys with an object, certain keys may become inaccessible.

Fix pending investigation; filing a bug over there and working on the association table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants