Re: tableView:objectValueForTableColumn: number column
Re: tableView:objectValueForTableColumn: number column
- Subject: Re: tableView:objectValueForTableColumn: number column
- From: Graham Cox <email@hidden>
- Date: Tue, 2 Feb 2010 23:44:22 +1100
On 02/02/2010, at 11:39 PM, Hado Hein wrote:
> eturnvalue = [[NSString stringWithFormat:@"%d", rowIndex]
> autorelease];
> That works fine.
No it doesn't, because:
> For convinience I wanted to provide the users with a numbering column in
> the front.
> The problem is that, at this point of code, I see no way to get the
> actual value to release it.
> The shown way with autorelease bails at the first attempt to scroll.
That's because you've made a silly mistake. [NSString stringWithFormat] returns an already autoreleased object, or one you don't own, at any rate. So you should not autorelease it again. The object will be sent a -release message twice, and on the second one, will fail with EXC_BAD_ACCESS as the object has already been dealloced.
--Graham
_______________________________________________
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