Re: NSTableview datasource issues
Re: NSTableview datasource issues
- Subject: Re: NSTableview datasource issues
- From: Alexander Spohr <email@hidden>
- Date: Sun, 20 Dec 2009 20:07:29 +0100
Am 20.12.2009 um 18:32 schrieb email@hidden:
> I did not give you all the methods in my code (it is too lengthy). segmentDict is a global variable because I need it somewhere else.
Sounds like bad design ;)
> a dealloc method takes care of releasing the arrays and dictionary.
Nope! First you alloc a dict in init:
> segmentDict =[NSMutableDictionarydictionary];
> [segmentDictretain];
And later you copy:
> -(IBAction)initializeSectorSegmentData:(id) sender
> {
> segmentDict=[[MyDocumentgetSectorSegmentData:(id) sender] mutableCopy];
// and retain
> [segmentDictretain];
That are three retains on segmentDict - and only one release in dealloc.
> - (void)awakeFromNib
> {
> segmentIndustryData=[[NSMutableArrayalloc] init];
> [segmentIndustryDataretain];
// double init/retain
> segmentDataController=[[NSArrayControlleralloc] init];
> [segmentDataControllerretain];
// double init/retain
> Anyway, even without retain, the table doesn't reload data.
>
> I do not think naming is the issue, it is more of the good habit to have.
It makes clear what you have at hand - if you stick to it.
Really, I don’t want to offend you but the code you show is buggy and leaks. I did not check the rest of your code after finding the release bugs.
atze
_______________________________________________
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