Re: arrayController setSortDescriptors: problem
Re: arrayController setSortDescriptors: problem
- Subject: Re: arrayController setSortDescriptors: problem
- From: Andrew Merenbach <email@hidden>
- Date: Tue, 1 Mar 2005 23:05:33 -0800
Hello, David. It appears that your autorelease is misplaced. Looking at the nesting of your line declaring the NSArray *descript, it appears that the array is being created autoreleased already (since you are using the much-simpler arrayWithObject: instead of alloc and initWithObjects:count: or another init: alternative). The NSSortDescriptor that you are creating, however, should be released somewhere, and I suspect that that's what you meant to do. Something like:
NSArray *descript = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"deadLine" ascending:YES selector:@selector(compare:)] autorelease]];
[arrayController setSortDescriptors:descript];
should do the trick, but this is composed in Mail.app. Conceptually, you appear to have no true problems besides this little one.
Cheers!
Andrew
On 1 Mar 2005, at 22:23, david kiers wrote:
Dear people,
I have a document-based application with a table view displaying the document’s content using an arrayController.
In the document's windowControllerDidLoadNib I set the arrayControllers sortDescriptors as follows:
NSArray *descript = [[NSArray arrayWithObject:[[NSSortDescriptor alloc]
initWithKey:@"deadLine" ascending:YES selector:@selector(compare:)]]autorelease];
[arrayController setSortDescriptors:descript];
The sorting works fine (using [arrayController rearrangeObjects]), until one of the tableView’s column headers is clicked. This exites the app due to signal 10 (SIGBUS).
The post column header click sortDescriptors array looks fine, for instance:
<CFArray 0x388ea0 [0xa01900e0]>{type = immutable, count = 2, values = (
0 : (auteur, ascending, caseInsensitiveCompare:)
1 : (deadLine, ascending, compare:)
)}
All works fine without the sortDescriptors being set, but then I’m obviously missing my initial sortDescriptor.
Does this provide enough information for anybody to describe a possible conceptual or practical misstep?
Thanks a lot,
David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden