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: "M. Uli Kusterer" <email@hidden>
- Date: Wed, 31 Mar 2004 18:51:33 +0200
At 12:14 Uhr -0700 30.03.2004, April Gendill wrote:
Make sure that if the array is global it is declared some where in
the header or above the implementation line in the class file.
NSMutableArray * serverWindows;
Just a suggestion: Do
NSMutableArray* serverWindows = nil;
then in your init method:
serverWindows = [[NSMutableArray alloc]init];
Wrap the actual code that alloc/inits the array in an
if( serverWindows == nil )
{
...
}
That way, when your code is called multiple times, it will just use
the same global array (which is probably the point of using a global
array anyway). Or if it isn't in your case, feel free to add an
if( serverWindows != nil )
{
[serverWindows release];
serverWindows = nil;
}
before the array creation step (you could then leave the
serverWindows == nil check, because it would either have been nil, or
be caught by the release above, which makes sure the old array is
released (i.e. you won't leak) and you still get a new, working array.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.