NSOutlineView crashes when I expand more than one cell
My Mac application has an NSOutlineView with different cells having data to be expanded. I am using this function:
(id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
to display data in columns of every cell.
In this function only, my application crashes. It happens when rows are displaying data. Piece of code is:
if (item)
{
NSLog(@"Passed first level");
//NSLog(@"Item is: %@", item); // CRASH POINT
if([item isKindOfClass:[NSDictionary class]]) // CRASH POINT
{
NSLog(@"Passed second level");
if([[tableColumn identifier] isEqualToString:@"columnA"])
{
NSLog(@"Column A");
outlineViewDataValue = [item valueForKey:@"columnA"];
}
and so on for other identifiers...
}
}
This code is called for different rows for every column. But once two or three parent nodes are expanded, then it开发者_如何学JAVA just blows off in a crash and displays that " IT PASSED level one BUT not Passed level Two". This is very surprising as after validating the data, it happens after working fine for three rows or four rows. Also, if try to print it's value, it does fine and print till it encounters crash. Even it doesn't display any data in item object.
Other required datasource functions are implemented and are working fine. Crash is every time at this point only marked as CRASH POINT.
When I expand more than one cell, it crashes when I expand the third cell or fourth cell. When there is only one row to expand, then there is no problem and we can expand and close again and again without any problem.
Crash stack is:
#0 0x93efaedb in objc_msgSend
#1 0x0001b745 in -[MyViewController outlineView:objectValueForTableColumn:byItem:] at MyViewController.m:26
#2 0x91c76b19 in -[NSOutlineView _dataSourceValueForColumn:row:]
#3 0x91c765f2 in -[NSTableView preparedCellAtColumn:row:]
#4 0x91c90acc in -[NSTableView _drawContentsAtRow:column:withCellFrame:]
#5 0x91c90a3a in -[NSOutlineView _drawContentsAtRow:column:withCellFrame:]
#6 0x91c8fb3a in -[NSTableView drawRow:clipRect:]
#7 0x91c8f572 in -[NSTableView drawRowIndexes:clipRect:]
#8 0x91c8f3ff in -[NSOutlineView drawRowIndexes:clipRect:]
#9 0x91c8df4b in -[NSTableView drawRect:]
#10 0x91c83a36 in -[NSView _drawRect:clip:]
#11 0x91c826d4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:]
#12 0x91c82a09 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:]
#13 0x91c82a09 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:]
#14 0x91c80bf3 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
Also, item object which is of id type, is fine and is of NSDictionary type till this problem arises and it shows during debugging as of id type only causing this problem.
Please suggest what can be done to track this crash, or to make sure that all related functions to expand and display/fetch data are working fine.
精彩评论