On Dec 3, 2013, at 14:46 , Jerry Krinock <je...@ieee.org> wrote:

> The window controller is being deallocced before the view controller.  So, 
> although the “base” part of the binding was still intact, this 
> keyPathForValuesAffecting was still in use when it was broken.
> 
> The view controller is instantiated in the nib.  The File’s Owner is the 
> window controller, which is wired in the nib to a ‘windowController’ *outlet* 
> of the view controller.

I ran into the same error recently, with an existing project which hadn’t 
previously been debugged under Mavericks. I believe the error is now appearing 
because Mavericks is checking for dangling observers more accurately.

The implication of your description, quoted above, is that the outlet is a 
‘weak' (or 'assign’) property. If it was strong, the window controller wouldn’t 
be deallocated before the view controller.

The problem is that such a windowController property isn’t KVO compliant. What 
you need is for the value to change to nil, KVO compliantly, when the nib is 
being discarded. That (the KVO compliance) will cause the automatic observers 
to stop observing the window controller, and then all will be well. If the 
property is weak, it’s changing to nil, but not KVO-compliantly. If it’s 
assign, then it’s not changing at all, even though the object it’s pointing to 
has been deallocated.

It seems likely that changing the outlet to strong will cause a reference 
cycle, so you'll have to find a way of breaking the cycle manually at suitable 
times.

_______________________________________________

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

Reply via email to