Re: App fails on Yosemite - "Cannot remove an observer"
Re: App fails on Yosemite - "Cannot remove an observer"
- Subject: Re: App fails on Yosemite - "Cannot remove an observer"
- From: Ken Thomases <email@hidden>
- Date: Sat, 29 Nov 2014 16:26:12 -0600
On Nov 29, 2014, at 2:27 PM, Andreas Höschler <email@hidden> wrote:
> we just tried one of our apps - doing fine on earlier versions of MacOSX - on Yosemite. When clicking on a tab of a NSTabView we get the following on the console and the app stops working (exception not caught):
>
> 29/11/14 21:21:23,496 SOSmartBrowser[731]: Cannot remove an observer <GSScrollView 0x7d706e60> for the key path "contentLayoutRect" from <GSWindow 0x7d71cf50> because it is not registered as an observer.
> 29/11/14 21:21:23,499 SOSmartBrowser[731]: (
> 0 CoreFoundation 0x9256c343 __raiseError + 195
> 1 libobjc.A.dylib 0x98481a2a objc_exception_throw + 276
> 2 CoreFoundation 0x9256c25d +[NSException raise:format:] + 141
> 3 Foundation 0x99f65b18 -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] + 739
> 4 Foundation 0x99f65787 -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] + 189
> 5 Foundation 0x99f76919 -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:context:] + 389
> 6 AppKit 0x9039c0af -[NSScrollView _setWindow:] + 429
> 7 AppKit 0x9037fe1e __21-[NSView _setWindow:]_block_invoke_2 + 52
> 8 CoreFoundation 0x9247bc3b __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 107
> 9 CoreFoundation 0x9247b27a -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 282
> 10 CoreFoundation 0x9247b0d5 -[NSArray enumerateObjectsUsingBlock:] + 53
> 11 AppKit 0x90afdca4 __21-[NSView _setWindow:]_block_invoke746 + 158
> 12 AppKit 0x9035afd5 -[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 111
> 13 AppKit 0x9035c91d -[NSView _setWindow:] + 2978
> 14 AppKit 0x90359e6f -[NSView addSubview:] + 453
> 15 AppKit 0x90359bb7 -[NSView replaceSubview:with:] + 152
> 16 AppKit 0x90621a4d -[NSTabView _switchTabViewItem:oldView:withTabViewItem:newView:initialFirstResponder:lastKeyView:] + 992
> 17 AppKit 0x906212d7 -[NSTabView selectTabViewItem:] + 568
> 18 AppKit 0x90a072ce -[NSTabView mouseDown:] + 166
> 19 AppKit 0x90b24c24 -[NSWindow _reallySendEvent:] + 12353
> 20 AppKit 0x9050dfb9 -[NSWindow sendEvent:] + 409
> 21 AppKit 0x904bba27 -[NSApplication sendEvent:] + 4679
> 22 AppKit 0x90335e0c -[NSApplication run] + 1003
> 23 AppKit 0x9031f310 NSApplicationMain + 2082
> 24 libdyld.dylib 0x98c466d9 start + 1
> 25 ??? 0x00000002 0x0 + 2
> )
>
> I am rather clueless since the exception is raised in Apples code!? What in our GSScrollView (NSScrollView) and GSWindow (NSWindow) subclasses could cause this problem on Yosemite?
You should look for memory management bugs, (possibly inadvertent) overrides of superclass properties where you fail to call through to the superclass or for which you fail to maintain KVO compliance, or overrides of KVO methods (e.g. -observeValueForKeyPath:…) which fail to call through to the superclass when the context is not the unique context you supplied when setting up the observation.
For the memory management bugs, build with the static analyzer and fix any problems it identifies. Run your app under the Zombie instrument and try to reproduce the crash.
Regards,
Ken
_______________________________________________
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