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: Andreas Höschler <email@hidden>
- Date: Mon, 01 Dec 2014 22:08:46 +0100
Hi Kyle,
>> Adding
>>
>> #ifdef __APPLE__
>> - (void)setWindow:(NSWindow *)window
>> {
>> }
>> #endif
>>
>> to my GSScrollView : NSScrollView subclass fixed (or at least worked around) the issue (no exception anymore and no apparent malfunction of the app).
>
> WOAAAAAHHHH. This is NOT the way to solve this problem!
Of course not!! But it at least makes the application available for the time being (needed to be urgently fixed or at least worked around).
> NSView and NSScrollView (may) do important work in -setWindow:! You just haven't noticed what you’ve broken yet.
I have posted the methods and ivars I have added to my subclasses. I can't see any obvious conflict with Apples API modifications!? And the app crashes in setWindow!? I see it that way. Apples implementation of NSScrollView::setWindow looks probably similar to this:
- (void)setWindow:(NSWindow *)window
{
// remove observer for _window::contentLayoutRect
[_window release];
_window = [window retain];
...
// add observer for _window::contentLayoutRect
}
Do you agree?
I expect a bug in Apples code where the ... are. May be a return before adding the observer again!??
I can only hope Apple fixes this with a Software Update soon!? Or do you have any further hints what I could have done wrong? Here are my ivars once again:
@interface GSScrollView : NSScrollView
{
NSSize _minSize;
}
@interface GSWindow : NSWindow
{
BOOL _suppressBecomingMainWin;
GSWindow *mainWin;
id filesOwner;
NSRect _tempRect;
}
Thanks,
Andreas
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
)
_______________________________________________
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