Re: Crash in datasource method when closing document
Re: Crash in datasource method when closing document
- Subject: Re: Crash in datasource method when closing document
- From: Michael Babin <email@hidden>
- Date: Thu, 10 Oct 2013 05:51:30 -0500
On Oct 10, 2013, at 12:06 AM, Shane Stanley <email@hidden> wrote:
> The problem I'm having is that if I open a file, then add an item, say a folder, then click the close button and choose Revert Changes, I (nearly always) get an exception thrown on the outline view's datasource method -outlineView:objectValueForTableColumn:byItem:. It doesn't happen if the outline view is hidden. I'm using ARC.
On Oct 10, 2013, at 1:51 AM, Shane Stanley <email@hidden> wrote:
> On 10 Oct 2013, at 5:39 PM, Jerry Krinock <email@hidden> wrote:
>
>> In order to receive -windowWillClose:, the object implementing it must be the delegate of the window which is closing.
>
> Yes, I already had -windowWillClose: implemented in my window controller (and -windowShouldClose:), and it gets called fine normally. But the crash I'm seeing is happening before it gets to that point. Maybe this will help:
>
> 2799 Thread_5984086 DispatchQueue_1: com.apple.main-thread (serial)
> + 2799 start (in libdyld.dylib) + 1 [0x7fff873e35fd]
> + 2799 main (in ASObjC Explorer) + 34 [0x100001d72] main.m:13
> + 2799 NSApplicationMain (in AppKit) + 940 [0x7fff89ca9803]
> + 2799 -[NSApplication run] (in AppKit) + 553 [0x7fff89cbe9cc]
> + 2799 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in AppKit) + 122 [0x7fff89cca8db]
> + 2799 _DPSNextEvent (in AppKit) + 1434 [0x7fff89ccb28e]
> + 2799 _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox) + 65 [0x7fff863a8abc]
> + 2799 ReceiveNextEventCommon (in HIToolbox) + 173 [0x7fff863a8b85]
> + 2799 RunCurrentEventLoopInMode (in HIToolbox) + 226 [0x7fff863a8f0d]
> + 2799 CFRunLoopRunSpecific (in CoreFoundation) + 309 [0x7fff897e8275]
> + 2799 __CFRunLoopRun (in CoreFoundation) + 776 [0x7fff897e87b8]
> + 2799 __CFRunLoopDoObservers (in CoreFoundation) + 391 [0x7fff897f7017]
> + 2799 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ (in CoreFoundation) + 23 [0x7fff897f70a7]
> + 2799 __83-[NSWindow _postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke1331 (in AppKit) + 46 [0x7fff8a43bcd1]
> + 2799 _handleWindowNeedsDisplayOrLayoutOrUpdateConstraints (in AppKit) + 884 [0x7fff89e6789e]
> + 2799 -[NSView displayIfNeeded] (in AppKit) + 1680 [0x7fff89e0263a]
> + 2799 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] (in AppKit) + 2828 [0x7fff89e23209]
> + 2799 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 314 [0x7fff89e26201]
> + 2799 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 6151 [0x7fff89e27f0e]
> + 2799 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 6151 [0x7fff89e27f0e]
> + 2799 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 6151 [0x7fff89e27f0e]
> + 2799 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 6151 [0x7fff89e27f0e]
> + 2799 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 6151 [0x7fff89e27f0e]
> + 2799 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 6151 [0x7fff89e27f0e]
> + 2799 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 6151 [0x7fff89e27f0e]
> + 2799 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 6151 [0x7fff89e27f0e]
> + 2799 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 841 [0x7fff89e26a50]
> + 2799 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] (in AppKit) + 2787 [0x7fff89e28fea]
> + 2799 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] (in AppKit) + 1799 [0x7fff89e28c0e]
> + 2799 -[NSView _drawRect:clip:] (in AppKit) + 3748 [0x7fff89e2a399]
> + 2799 -[NSTableView drawRect:] (in AppKit) + 1484 [0x7fff89e514c2]
> + 2799 -[NSOutlineView drawRowIndexes:clipRect:] (in AppKit) + 113 [0x7fff89fe2455]
> + 2799 -[NSTableView drawRowIndexes:clipRect:] (in AppKit) + 776 [0x7fff89f87f7d]
> + 2799 -[NSTableView drawRow:clipRect:] (in AppKit) + 1629 [0x7fff89f88723]
> + 2799 -[NSOutlineView _drawContentsAtRow:column:withCellFrame:] (in AppKit) + 91 [0x7fff89fe323f]
> + 2799 -[NSTableView _drawContentsAtRow:column:withCellFrame:] (in AppKit) + 44 [0x7fff89f889ee]
> + 2799 -[NSOutlineView preparedCellAtColumn:row:] (in AppKit) + 52 [0x7fff89fe27c8]
> + 2799 -[NSTableView preparedCellAtColumn:row:] (in AppKit) + 399 [0x7fff89f88cc8]
> + 2799 -[SMSFWOutlineViewController outlineView:objectValueForTableColumn:byItem:] (in ASObjC Explorer) + 95 [0x1000721ff] SMSFWOutlineViewController.m:82
> + 2799 objc_storeStrong (in libobjc.A.dylib) + 32 [0x7fff8257ac81]
> + 2799 objc_retain (in libobjc.A.dylib) + 18 [0x7fff825657a2]
From your description, it appears that you're presenting a window/sheet when the window is asked to close (Save/revert changes?). When the revert option is selected, what changes occur to the underlying data supporting the outline view?
Once the window/sheet is dismissed, it looks like the main/document window is asked to redraw its contents and the problem occurs there (redrawing the outline view). That probably occurs before the -windowWillClose: call takes place.
_______________________________________________
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