Re: firstResponder KVO snow leopard crash; bug?
Re: firstResponder KVO snow leopard crash; bug?
- Subject: Re: firstResponder KVO snow leopard crash; bug?
- From: Corbin Dunn <email@hidden>
- Date: Wed, 18 Nov 2009 09:00:18 -0800
On Nov 17, 2009, at 1:04 PM, Aaron Clarke wrote:
> We have an application that runs fine on leopard (10.5) but occasionally
> crashes on snow leopard (10.6) when closing an NSWindow. Here is the
> backtrace for the crash:
>
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
> 0x976e691b in objc_msgSend ()
> (gdb) bt
> #0 0x976e691b in objc_msgSend ()
> #1 0x197142d0 in ?? ()
> #2 0x9031e88e in NSKeyValuePushPendingNotificationPerThread ()
> #3 0x9031e224 in NSKeyValueWillChange ()
> #4 0x9030350b in -[NSObject(NSKeyValueObserverNotification)
> willChangeValueForKey:] ()
> #5 0x90327cfe in _NSSetObjectValueAndNotify ()
> #6 0x92745fb8 in -[NSWindow makeFirstResponder:] ()
> ...
>
> Even if it doesn't crash, closing the NSWindow always results in the
> following error message.
>
> An instance 0x11b75230 of class MyWindow was deallocated while key value
> observers were still registered with it. Observation info was leaked, and
> may even become mistakenly attached to some other object. Set a breakpoint
> on NSKVODeallocateBreak to stop here in the debugger. Here's the current
> observation info:
> <NSKeyValueObservationInfo 0x19408190> (
> <NSKeyValueObservance 0x194233d0: Observer: 0x463afa0, Key path:
> firstResponder, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0,
> Property: 0x4453e60>
> <NSKeyValueObservance 0x1ab6ad40: Observer: 0x19427a80, Key path:
> firstResponder, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0,
> Property: 0x4453e60>
> )
>
> I looked at what the observer object's class is, and it's a subclass of
> NSCollectionView. We do not explicitly setup a KVO relationship for
> firstResponder. I also noticed that the "Application Kit Release Notes for
> Snow Leopard" mention that firstResponder is KVO-compliant, which makes me
> believe this is something new in Snow Leopard. All this information makes
> me believe this is potentially a bug in Application Kit for 10.6. Maybe we
> setup an NSCollectionView incorrectly or I'm misinterpreting this
> information?
Oh -- another thing. Does your subclass of NSCollectionView override:
(void)viewWillMoveToWindow:(NSWindow *)window {
but not call super? If not... call super! Your classes should always call super if it is defined in a superclass, unless you have a good reason to hide the super's behavior.
corbin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden