Re: “EXC_BAD_ACCESS” on Custom TableView with custom NSCell when clicking.
Re: “EXC_BAD_ACCESS” on Custom TableView with custom NSCell when clicking.
- Subject: Re: “EXC_BAD_ACCESS” on Custom TableView with custom NSCell when clicking.
- From: Corbin Dunn <email@hidden>
- Date: Wed, 17 Feb 2010 12:44:11 -0800
On Feb 17, 2010, at 12:16 PM, Gustavo Pizano wrote:
> Hello all.
>
> in My Core Data application I have a custom NSTableView with Custom NSCells inside because Im displaying the name of the user with the image of the user (the picture), its displaying fine, when selecting its selecting ok.. so far so good..
>
> But I implemented the -(void)rightMouseDown:(NSEvent *)theEvent{, where I display a custom magic view panel, like the ones on the dock, and I do the following after I display the panel:
>
> NSInteger rowInt = [self rowAtPoint:_mousePoint];
> ...
> ....
> [[(UserListViewController *)[self _myController] _userListArrayController] setSelectionIndex:rowInt];
> ..
> ...
> The UserControllerList is the NSArrayController that holds the Users of the table. Then When I select (normal click another user) randomly occurs the “EXC_BAD_ACCESS”.
>
> Checking in the debugger I see that the last method that was called was:
>
> -(NSDictionary *)userDictionary{
> return [self dictionaryWithValuesForKeys:[NSArray arrayWithObjects:@"firstName",@"lastName",@"avatar",@"title",nil]];
> }
>
> which is a method that returns the keys for the User entity attributes, I did so following Tim blog. : http://www.timisted.net/blog/archive/custom-cells-and-core-data/.
>
> So Im guessing that somehow when setting the selectedIndex in the the NSArrayController Im messing up with the insights of it and then suddenly it will blow up if I keep left clicking the user list changing selections.
>
> Or I have something wrong in the approach I took to display the fields in the custom NSCell.
>
> I tried to blow the app up by just left-clicking and it happens also but not so immediately as when I right click an item in the list, which tells me that definitely there is something wrong in the approach to display Core Data attributes in a custom NSCell.
>
> Any ideas?
Yes -- read:
http://www.corbinstreehouse.com/blog/2007/10/instruments-on-leopard-how-to-debug-those-random-crashes-in-your-cocoa-app/
...but, I'd guess that your cell isn't implementing -copyWithZone: correctly (or at all).
corbin
_______________________________________________
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