Re: NSSplitView crash upon restore from 10.8 Versions Browser
Re: NSSplitView crash upon restore from 10.8 Versions Browser
- Subject: Re: NSSplitView crash upon restore from 10.8 Versions Browser
- From: Lee Ann Rucker <email@hidden>
- Date: Mon, 20 Aug 2012 15:41:47 -0700
I've hit issues with splitView delegate getting called after the delegate is dealloced, and my setDelegate happens in the nib - normally what gets set in the nib gets unset correctly later. I had to put in a NSWindowWillCloseNotification observer and clear the splitView delegate there.
It's an incredibly complex window with lots of connections (but no leaks or retain cycles), and it didn't happen in my stripped-down sample app, so I never filed it.
I really wish the converse of awakeFromNib was public so we could do our own pre-dealloc nib teardown when we need to.
On Aug 20, 2012, at 2:14 PM, Kevin Perry wrote:
> Looks like the crash is happening while attempting to invoke -respondsToSelector:.
>
> Odds are that this is a message being sent to [self delegate], which looks like a deallocated object.
>
> Is it possible that the split view is outliving its delegate? Typically, when a delegate gets deallocated (or when you release it for the last time), you are responsible for calling setDelegate:nil on anything that you had previously set it as a delegate for.
>
> -KP
>
> On Aug 20, 2012, at 12:57 PM, Jerry Krinock <email@hidden> wrote:
>
>> SUMMARY
>>
>> While testing an app in 10.8 today, it crashed three times out of six upon restoring from the Versions Browser. But the problem has now gone away. I don't have enough information to file a bug report or try any more workarounds, so I'm throwing my observations out there in case someone else has seen or will see this problem. Maybe we can put our observations together and get further.
>>
>> DETAILS
>>
>> Crash report is at end of this message. You see all of the stack is in Apple's code.
>>
>> Not knowing what else to do, I subclassed NSSplitView, to log the parameters and invoke super. After doing this, I couldn't make it crash any more :| The logged parameters were always reasonable. Assuming that this is going to bite back later, I left it subclassed with the following rather do-nothing implementation…
>>
>> - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
>> NSRect screenFrame = [[[self window] screen] frame] ;
>>
>> if (oldBoundsSize.width > screenFrame.size.width) {
>> NSLog(@"Warning 502-9481 clipped split view width to %f",
>> screenFrame.size.width) ;
>> }
>> if (oldBoundsSize.height > screenFrame.size.height) {
>> NSLog(@"Warning 502-9482 clipped split view height to %f",
>> screenFrame.size.height) ;
>> }
>>
>> [super resizeSubviewsWithOldSize:oldBoundsSize] ;
>> }
>>
>> Maybe it will crash again someday and tell me something.
>>
>> Other factors which may be involved…
>>
>> • Just last week, I cleaned up and started compiling this app as 64-bit, built in Xcode 4 with NSSplitView and Mac OS X 10.8 SDK. The version now in the field is 32-bit only, built in Xcode 3 with RBSplitView and Mac OS X 10.6 SDK.
>> • In Mac OS X 10.8, in the Versions browser, when clicking on the view of the old version, the view magnifies and gets bigger. I don't remember this happening in 10.7. Possibly this resizing is triggering the crash.
>> • Others have seen this method crash, although in different ways…
>> http://dev.sequelpro.com/log/viewreports/1392/37095
>> http://dev.sequelpro.com/log/view/1392
>>
>> Thanks for reading,
>>
>> Jerry Krinock
>>
>> Here is some of the crash report…
>>
>> Code Type: X86-64 (Native)
>> Parent Process: launchd [125]
>> User ID: 501
>>
>> Date/Time: 2012-08-20 05:36:00.652 -0700
>> OS Version: Mac OS X 10.8 (12A256)
>> Report Version: 10
>>
>> Interval Since Last Report: 12640 sec
>> Crashes Since Last Report: 1
>> Per-App Crashes Since Last Report: 1
>>
>> Crashed Thread: 0 Dispatch queue: com.apple.main-thread
>>
>> Exception Type: EXC_BAD_ACCESS (SIGSEGV)
>> Exception Codes: EXC_I386_GPFLT
>>
>> Application Specific Information:
>> objc_msgSend() selector name: respondsToSelector:
>>
>>
>> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
>> 0 libobjc.A.dylib 0x00007fff8c0b0590 objc_msgSend_vtable5 + 16
>> 1 com.apple.AppKit 0x00007fff90a316d5 -[NSSplitView resizeSubviewsWithOldSize:] + 370
>> 2 com.apple.AppKit 0x00007fff908103c8 -[NSView setFrameSize:] + 1101
>> 3 com.apple.AppKit 0x00007fff9080fc0e -[NSView setFrame:] + 299
>> 4 com.apple.AppKit 0x00007fff90864e92 -[NSView resizeWithOldSuperviewSize:] + 1502
>> 5 com.apple.AppKit 0x00007fff90863fd7 -[NSView resizeSubviewsWithOldSize:] + 318
>> 6 com.apple.AppKit 0x00007fff908103c8 -[NSView setFrameSize:] + 1101
>> 7 com.apple.AppKit 0x00007fff9080fc0e -[NSView setFrame:] + 299
>> 8 com.apple.AppKit 0x00007fff90a10f6d -[NSTabView _resizeSelectedTabViewItem] + 119
>> 9 com.apple.AppKit 0x00007fff90a10ee4 -[NSTabView setFrameSize:] + 218
>> 10 com.apple.AppKit 0x00007fff9080fc0e -[NSView setFrame:] + 299
>> 11 com.apple.AppKit 0x00007fff90864e92 -[NSView resizeWithOldSuperviewSize:] + 1502
>> 12 com.apple.AppKit 0x00007fff90863fd7 -[NSView resizeSubviewsWithOldSize:] + 318
>> 13 com.apple.AppKit 0x00007fff908103c8 -[NSView setFrameSize:] + 1101
>> 14 com.apple.AppKit 0x00007fff9080fc0e -[NSView setFrame:] + 299
>> 15 com.apple.AppKit 0x00007fff90864e92 -[NSView resizeWithOldSuperviewSize:] + 1502
>> 16 com.apple.AppKit 0x00007fff90863fd7 -[NSView resizeSubviewsWithOldSize:] + 318
>> 17 com.apple.AppKit 0x00007fff908103c8 -[NSView setFrameSize:] + 1101
>> 18 com.apple.AppKit 0x00007fff9086e254 -[NSThemeFrame setFrameSize:] + 513
>> 19 com.apple.AppKit 0x00007fff9086d34f -[NSWindow _setFrame:updateBorderViewSize:] + 929
>> 20 com.apple.AppKit 0x00007fff9086cac4 -[NSWindow _oldPlaceWindow:] + 1142
>> 21 com.apple.AppKit 0x00007fff9086bf79 -[NSWindow _setFrameCommon:display:stashSize:] + 1837
>> 22 com.apple.AppKit 0x00007fff90733933 __28-[NSMoveHelper _doAnimation]_block_invoke_0 + 1003
>> 23 com.apple.CoreFoundation 0x00007fff8bd464b4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
>> 24 com.apple.CoreFoundation 0x00007fff8bd45fcd __CFRunLoopDoTimer + 557
>> 25 com.apple.CoreFoundation 0x00007fff8bd2b7b9 __CFRunLoopRun + 1513
>> 26 com.apple.CoreFoundation 0x00007fff8bd2add2 CFRunLoopRunSpecific + 290
>> 27 com.apple.AppKit 0x00007fff9073332c -[NSMoveHelper _doAnimation] + 1373
>> 28 com.apple.AppKit 0x00007fff90732b66 -[NSMoveHelper _resizeWindow:toFrame:display:] + 493
>> 29 com.apple.AppKit 0x00007fff90a1f773 -[NSWindow setFrame:display:animate:] + 1337
>> 30 com.apple.AppKit 0x00007fff90f8314c __block_global_9 + 141
>> 31 libdispatch.dylib 0x00007fff95c64f3d _dispatch_call_block_and_release + 15
>> 32 libdispatch.dylib 0x00007fff95c610fa _dispatch_client_callout + 8
>> 33 libdispatch.dylib 0x00007fff95c659ab _dispatch_after_timer_callback + 22
>> 34 libdispatch.dylib 0x00007fff95c610fa _dispatch_client_callout + 8
>> 35 libdispatch.dylib 0x00007fff95c632d7 _dispatch_source_invoke + 691
>> 36 libdispatch.dylib 0x00007fff95c62349 _dispatch_queue_invoke + 72
>> 37 libdispatch.dylib 0x00007fff95c660cd _dispatch_main_queue_callback_4CF + 220
>> 38 com.apple.CoreFoundation 0x00007fff8bd2b81e __CFRunLoopRun + 1614
>> 39 com.apple.CoreFoundation 0x00007fff8bd2add2 CFRunLoopRunSpecific + 290
>> 40 com.apple.HIToolbox 0x00007fff8d2a3774 RunCurrentEventLoopInMode + 209
>> 41 com.apple.HIToolbox 0x00007fff8d2a3512 ReceiveNextEventCommon + 356
>> 42 com.apple.HIToolbox 0x00007fff8d2a33a3 BlockUntilNextEventMatchingListInMode + 62
>> 43 com.apple.AppKit 0x00007fff9083d1d3 _DPSNextEvent + 685
>> 44 com.apple.AppKit 0x00007fff9083ca92 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
>> 45 com.apple.AppKit 0x00007fff90833e33 -[NSApplication run] + 517
>> 46 com.apple.AppKit 0x00007fff907d8886 NSApplicationMain + 869
>>
>>
>> _______________________________________________
>>
>> 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
>
>
> _______________________________________________
>
> 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
_______________________________________________
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