I am calling save in my NSOutlineView's
-(void)editingDidEnd:(NSNotification *)notification; method and it's causing the next outline view delegate method in the chain to fail because Item is null. Is this because save is doing something behind the scenes that wipes out the memory address of item temporarily?
So my edit method looks like this:
- (void)editingDidEnd:(NSNotification *)notification {
NSTextField *textField = [notification object];
SBCategory *item = [_categoryOutlineView itemAtRow:[_categoryOutlineView selectedRow]];
NSString* value = [textField stringValue];
item.title = value;
[item saveCategoryDocument];
}
saveCategoryDocument looks like this:
-(BOOL)saveCategoryDocument {
NSError* error;
BOOL ok = [self save: &error];
if (error) {
NSLog(@"Error creating categories document %@", error.localizedDescription);
}
return ok;
}
and the next delegate in line looks like this
-(BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item {
return [item isHeader];
}
In the above method, item is null. If I comment out
[item saveCategoryDocument]; in editingDidEnd then every thing works fine ... but it obviously doesn't save the document.