Re: Newbie question: chrash on [tableview reloadData]
Re: Newbie question: chrash on [tableview reloadData]
- Subject: Re: Newbie question: chrash on [tableview reloadData]
- From: Fritz Anderson <email@hidden>
- Date: Thu, 21 Nov 2002 14:50:40 -0600
There's your problem: Neither dirEnumerator nor currentName came to you
by a 'copy,' 'new,' or 'alloc' method, and you never retained them, so
they were not yours to release. They were either autoreleased when you
got them, or referred to objects whose owners would release them for
you.
The release messages are where the error occurred, but it didn't mature
to a crash until it came time to refresh the NSTableView. It had
nothing to do with your NSMutableArray at all.
-- F
On Thursday, November 21, 2002, at 02:30 PM, Terje Tjervaag wrote:
Thanks to you who have replied. I have now found the exact source of
the crash. From the source code listed below, if I comment out the
[dirEnumerator release] line, like I have done below, the app runs
fine. I suppose then I am not meant to touch the
NSDirectoryEnumerator after I have created it, but I really don't
understand why this is affecting my NSMutableArray 'files' after I
have finished filling it with filenames from the directory
enumerator. Anyone care to explain?
NSDirectoryEnumerator *dirEnumerator = [[NSFileManager defaultManager]
enumeratorAtPath:[path stringValue]];
...
while (currentName = [dirEnumerator nextObject]) {
...
}
// Make sure objects are released
//[dirEnumerator release];
//[currentName release];
// Refresh table
[self updateUI];
--
Fritz Anderson - Consulting Programmer - Chicago, IL
Mail: <email@hidden>
Risumi: <
http://resume.manoverboard.org>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.