在我的应用程序中,我有一个 NSOutlineview 刷新太频繁,并且崩溃,得到以下堆栈跟踪
Exception Name: NSInternalInconsistencyException
Description: (null) should not be expanded already!
User Info: (null)
0 CoreFoundation 0x00007fff918840a6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff96eef3f0 objc_exception_throw + 43
2 CoreFoundation 0x00007fff91883ee8 +[NSException raise:format:arguments:] + 104
3 Foundation 0x00007fff9769a6a2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 AppKit 0x00007fff933e19b0 -[NSOutlineView _expandItemEntry:expandChildren:startLevel:] + 1153
5 AppKit 0x00007fff933c7c42 -[NSOutlineView _uncachedNumberOfRows] + 379
6 AppKit 0x00007fff93401938 -[NSOutlineView frameOfCellAtColumn:row:] + 66
7 AppKit 0x00007fff9379f51c -[NSTableViewDynamicToolTipManager dynamicToolTipRectAtPoint:] + 298
8 AppKit 0x00007fff9385cb9a -[NSViewDynamicToolTipManager _markMovementTrackingInfo] + 142
9 AppKit 0x00007fff933f5d0a -[NSViewDynamicToolTipManager _restartMovementTracking] + 231
10 AppKit 0x00007fff933f5b8b -[NSViewDynamicToolTipManager _viewVisibleBoundsChanged] + 526
11 AppKit 0x00007fff933f58eb -[NSViewDynamicToolTipManager _threadsafeViewVisibleBoundsChanged] + 39
12 AppKit 0x00007fff9336cda7 -[NSView(NSInternal) _updateTrackingAreas] + 479
13 AppKit 0x00007fff933f6be8 -[NSOutlineView _updateTrackingAreas] + 99
14 CoreFoundation 0x00007fff9187ca46 __NSArrayEnumerate + 582
15 AppKit 0x00007fff9336d090 -[NSView(NSInternal) _updateTrackingAreas] + 1224
16 CoreFoundation 0x00007fff9187ca46 __NSArrayEnumerate + 582
17 AppKit 0x00007fff9336d090 -[NSView(NSInternal) _updateTrackingAreas] + 1224
18 AppKit 0x00007fff9336dded -[NSScrollView _updateTrackingAreas] + 122
19 CoreFoundation 0x00007fff9187ca46 __NSArrayEnumerate + 582
20 AppKit 0x00007fff9336d090 -[NSView(NSInternal) _updateTrackingAreas] + 1224
21 CoreFoundation 0x00007fff9187ca46 __NSArrayEnumerate + 582
22 AppKit 0x00007fff9336d090 -[NSView(NSInternal) _updateTrackingAreas] + 1224
23 CoreFoundation 0x00007fff9187ca46 __NSArrayEnumerate + 582
24 AppKit 0x00007fff9336d090 -[NSView(NSInternal) _updateTrackingAreas] + 1224
25 AppKit 0x00007fff9336caac _handleInvalidCursorRectsNote + 863
26 CoreFoundation 0x00007fff9184a9b7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
27 CoreFoundation 0x00007fff9184a921 __CFRunLoopDoObservers + 369
28 CoreFoundation 0x00007fff91825d88 __CFRunLoopRun + 728
29 CoreFoundation 0x00007fff918256b2 CFRunLoopRunSpecific + 290
30 HIToolbox 0x00007fff96a0f0a4 RunCurrentEventLoopInMode + 209
31 HIToolbox 0x00007fff96a0ee42 ReceiveNextEventCommon + 356
32 HIToolbox 0x00007fff96a0ecd3 BlockUntilNextEventMatchingListInMode + 62
33 AppKit 0x00007fff93292613 _DPSNextEvent + 685
34 AppKit 0x00007fff93291ed2 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
35 AppKit 0x00007fff93289283 -[NSApplication run] + 517
36 AppKit 0x00007fff9322dcb6 NSApplicationMain + 869
这是我得到的断言,
*** Assertion failure in -[MyCustomOutlineView _expandItemEntry:expandChildren:startLevel:], /SourceCache/AppKit/AppKit-1187.34/TableView.subproj/NSOutlineView.m:1309
2013-01-16 21:16:41.346 AppName[4149:303] (null) should not be expanded already!
任何线索我该如何调试它
编辑场景
这是客户端 - 服务器应用程序,
Client will listen from a Socket in a **thread, and data will come in XML Format**
In the same thread it will Extract the XML Data and Form a NSMutableDictionary & NSMutableArray
something like this,
NSMutableArray *rootArray = will contain all first level of item,
each element of rootArray will be of type OutlineViewData class, this will contain any additional info whether they are single element or it can be another group item ,
if at all they are group item again there will be an array and so on..
**From listen thread i am calling OutlineView reload data over main thread.**
我在怀疑什么
事情就是这样发生的,
void SocketListenerThread(){
while ( hasData ){
if ( xmlOutLineData ){
pData = Make Outline Data ; // This is modifying the Data which will be
// display/used by the NSOutlineView
}
[ Call To Reload the NSOutlineView on the main thread ]
}
}
我期待 NSOutlineView reloadData 正在阻塞调用,但它似乎没有阻塞调用,这可能正在发生,我正在编辑/可能正在删除或添加一些条目到 pData 再次被 NSOutline 委托方法引用以显示 Outlineview,
有没有办法让 NSOutlineView reloadData 的阻塞行为 提前谢谢..