• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EXC_BAD_ACCESS on breakpoint
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EXC_BAD_ACCESS on breakpoint


  • Subject: Re: EXC_BAD_ACCESS on breakpoint
  • From: Brent Smith <email@hidden>
  • Date: Thu, 6 May 2010 21:07:35 -0700

On May 6, 2010, at 8:08 PM, Kyle Sluder wrote:

> On Thu, May 6, 2010 at 7:21 PM, Brent Smith <email@hidden> wrote:
>> I have an NSTask thats running a method for me and Im trying to debug why its currently not working. I can go about using my program normally when I select Build and Run, but when I add a breakpoint and select Build and Debug I get an EXC_BAD_ACCESS. Normally this is caused by some sort of deallocation, but Im not dealing with any deallocating objects. Turning on NSZombieEnabled doesnt change anything. The code is as follows
>
> Where are you putting the breakpoint? Where does this code live? Who calls it?

breakpoint is going on the if(!newLinesString isEqualToString:@""]) line

It lives in the appdelegate and its called by the notification center,

[[ NSNotificationCenter defaultCenter ] addObserver: self
													   selector: @selector(newLines:)
														   name: @"NSFileHandleDataAvailableNotification"
														 object: [pipe fileHandleForReading]];

>
>>    mainPool = [[ NSAutoreleasePool alloc ] init ];
>>
>>    NSData *newLines;
>>    NSString *newLinesString;
>>    newLines = [[aNotification object] availableData ];
>>    newLinesString = [[[NSString alloc ] initWithData: newLines encoding:NSUTF8StringEncoding] retain];
>>
>>    if(![newLinesString isEqualToString:@""])
>>                {
>>       NSArray *tempArray = [newLinesString componentsSeparatedByString:@"\n"];
>>       NSMutableArray *mArray = [[NSMutableArray alloc] initWithArray:tempArray];
>>
>>
>> I also receive this error just before the call.
>
> What call?
>
Just before NSArray *tempArray = [newLinesString componentsSeparatedByString:@"\n"];


>> If I look at my newLinesString variable in the Locals section, it looks perfect.
>
> Except for the fact that you've done [[NSString alloc]
> initWithData:encoding:] retain], thus double-retaining it.

Again ignore the retain, I was just messing around, meant to remove that from the post.

>
> --Kyle Sluder

_______________________________________________

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

References: 
 >EXC_BAD_ACCESS on breakpoint (From: Brent Smith <email@hidden>)
 >Re: EXC_BAD_ACCESS on breakpoint (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: EXC_BAD_ACCESS on breakpoint
  • Next by Date: Re: EXC_BAD_ACCESS on breakpoint
  • Previous by thread: Re: EXC_BAD_ACCESS on breakpoint
  • Next by thread: Re: EXC_BAD_ACCESS on breakpoint
  • Index(es):
    • Date
    • Thread