Re: Why does this keep sending EXC_BAD_ACCESS
Re: Why does this keep sending EXC_BAD_ACCESS
- Subject: Re: Why does this keep sending EXC_BAD_ACCESS
- From: Gorazd Krosl <email@hidden>
- Date: Tue, 30 Mar 2004 13:29:16 -0500 (EST)
Angel,
Both, your serverWindos and chanellWindws get
released:
>
> serverWindows = [[NSMutableArray
arrayWithCapacity:5] autorelease];
After this line your serverWindows array has retain
count of 1 and 2 pending autorelease events. Question:
Why are you using "convenience" initializer and why
are you sending additional autorelease message?
>
> [serverWindows retain];
After this line is executed, retain count of
serverWindows is 2. When autorelease pool is
deallocated after current event loop, your
serverWindows will be released (retain count = 2 - 2
autorelease calls) == 0.
I would write:
serverWindows = [[NSMutableArray alloc]
initWithCapacity:5];
This gives you object with retain count of 1 that you
release as needed with [serverWindows release].
The same applays for channelWindows.
HTH
Gorazd
______________________________________________________________________
Post your free ad now!
http://personals.yahoo.ca
_______________________________________________
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.