Re: Return causes EXC_BAD_ACCESS
Re: Return causes EXC_BAD_ACCESS
- Subject: Re: Return causes EXC_BAD_ACCESS
- From: Dave DeLong <email@hidden>
- Date: Thu, 28 Jul 2011 14:35:54 -0700
It kind of looks like foundCookieJar is an ivar, which means that "return foundCookieJar" is really going to be "return self->foundCookieJar". Since you set "self" to "nil", you're trying to dereference a NULL pointer, which is a great way to crash your app.
HTH,
Dave
On Jul 28, 2011, at 2:33 PM, Mr. Gecko wrote:
> I am unable to find out as to why I am receiving this problem, I can verify other parts of the code before it gets to the return and that the object I am returning does in-fact work as I am able to NSLog it and see the description of it. The basic idea of this code is to notify other objects to see if one exists with the same path and if it does, it will tell the object I am using to check where it is at by setFoundCookieJar:self. It seems to work, as I can see the value when logging it. This one problem is stopping the code I wrote from being usable.
>
> If someone can explain why this is happening and give me a link to explanation on this signal and why it occurs as I have and a friend of mine has seen it in weird areas that seems like it should work from an understand of the code and playing around seems like it will work by logging out information. From my understanding, this should happen when you, for an example, try to access the pointer 0x18c95b0 whenever that belongs to another process. However, I also thought that the Mac has a copy of memory space for each process and therefore should not be able to access memory that it doesn't own unless the core os does so.
>
> [notificationCenter postNotificationName:MGMCookieJarExists object:self userInfo:[NSDictionary dictionaryWithObject:cookiesPath forKey:MGMCookieJarKey]];
> if (foundCookieJar!=nil) {
> [self release];
> self = nil;
> return foundCookieJar;
> }
>
> Thanks for any help on this issue,
> Mr. Gecko_______________________________________________
>
> 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
_______________________________________________
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